<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>It seems erl_types.erl contains the mystery of types definitions and internal checks. And the dict() type declaration is hard-coded, so we can use the dict() type. But I still can't find single document to list dict() and other hidden types declarations.</div><div><br></div><div><div>On Oct 27, 2011, at 6:18 PM, Michael Richter wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">From <a href="http://www.erlang.org/doc/man/dict.html">http://www.erlang.org/doc/man/dict.html</a>:<div><span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: medium; "><br>
</span></div><div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: medium; ">The representation of a dictionary is not defined.</span></blockquote><div>
<br></div><div>That being said, cracking open the code for lib/stdlib/dict.erl I find:</div><div><br></div><div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<font class="Apple-style-span" face="'courier new', monospace">-record(dict,<br><span class="Apple-tab-span" style="white-space:pre"> </span>{size=0<span class="Apple-tab-span" style="white-space:pre"> </span> :: non_neg_integer(), <span class="Apple-tab-span" style="white-space:pre"> </span>% Number of elements<br>
<span class="Apple-tab-span" style="white-space:pre"> </span> n=?seg_size<span class="Apple-tab-span" style="white-space:pre"> </span> :: non_neg_integer(), <span class="Apple-tab-span" style="white-space:pre"> </span>% Number of active slots<br>
<span class="Apple-tab-span" style="white-space:pre"> </span> maxn=?seg_size<span class="Apple-tab-span" style="white-space:pre"> </span> :: non_neg_integer(),<span class="Apple-tab-span" style="white-space:pre"> </span>% Maximum slots<br>
<span class="Apple-tab-span" style="white-space:pre"> </span> bso=?seg_size div 2 :: non_neg_integer(), <span class="Apple-tab-span" style="white-space:pre"> </span>% Buddy slot offset<br><span class="Apple-tab-span" style="white-space:pre"> </span> exp_size=?exp_size :: non_neg_integer(), <span class="Apple-tab-span" style="white-space:pre"> </span>% Size to expand at<br>
<span class="Apple-tab-span" style="white-space:pre"> </span> con_size=?con_size :: non_neg_integer(), <span class="Apple-tab-span" style="white-space:pre"> </span>% Size to contract at<br><span class="Apple-tab-span" style="white-space:pre"> </span> empty<span class="Apple-tab-span" style="white-space:pre"> </span> :: tuple(),<span class="Apple-tab-span" style="white-space:pre"> </span>% Empty segment<br>
<span class="Apple-tab-span" style="white-space:pre"> </span> segs<span class="Apple-tab-span" style="white-space:pre"> </span> :: tuple()<span class="Apple-tab-span" style="white-space:pre"> </span> <span class="Apple-tab-span" style="white-space:pre"> </span>% Segments<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>}).<br>%% A declaration equivalent to the following one is hard-coded in erl_types.<br>%% That declaration contains hard-coded information about the #dict{}<br>
%% structure and the types of its fields. So, please make sure that any<br>%% changes to its structure are also propagated to erl_types.erl.<br>%%<br>%% -opaque dict() :: #dict{}.</font></blockquote></div><br><div class="gmail_quote">
On 26 October 2011 15:03, Gary Hai <span dir="ltr"><<a href="mailto:gary@xl59.com">gary@xl59.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div>Thanks a lot. I want to get the full list of built-in types spec, while as dict() is missed in official document but is used anywhere. So another question is where is the built-in types specs declared, specially, the dict() type.</div>
<div class="im"><div><blockquote type="cite"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
<div><font face="'courier new', monospace">./lib/compiler/src/rec_env.erl:-type mapping() :: {'map', <font color="#7e0905">dict</font>()} | {'rec', <font color="#af1209">dict</font>(), <font color="#f93a20">dict</font>()}.</font></div>
</blockquote></blockquote></div><br></div><div><div></div><div class="h5"><div><div>On Oct 26, 2011, at 12:30 PM, Michael Richter wrote:</div><br><blockquote type="cite"><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><b><font face="'courier new', monospace">michael@isolde:~/Development/Erlang/otp_src_R14B04$ for a in type spec ; do grep "^-$a" $(find . -name *.erl -or -name *.hrl) ; done</font></b></div>
<div><font face="'courier new', monospace">./bootstrap/lib/parsetools/include/yeccpre.hrl:-type yecc_ret() :: {'error', _} | {'ok', _}.</font></div><div><font face="'courier new', monospace">./bootstrap/lib/stdlib/include/erl_bits.hrl:-type bt_endian():: 'big' | 'little' | 'native'.</font></div>
<div><font face="'courier new', monospace">./bootstrap/lib/stdlib/include/erl_bits.hrl:-type bt_sign() :: 'signed' | 'unsigned'.</font></div><div><font face="'courier new', monospace">./bootstrap/lib/stdlib/include/erl_bits.hrl:-type bt_type() :: 'integer' | 'float' | 'binary' | 'utf8' | 'utf16' | 'utf32'.</font></div>
<div><font face="'courier new', monospace">./bootstrap/lib/stdlib/include/erl_bits.hrl:-type bt_unit() :: 1..256.</font></div><div><font face="'courier new', monospace">./lib/compiler/test/compile_SUITE.erl:-type all_return_type() :: [atom()].</font></div>
<div><font face="'courier new', monospace">./lib/compiler/src/rec_env.erl:-type mapping() :: {'map', dict()} | {'rec', dict(), dict()}.</font></div><div><font face="'courier new', monospace">./lib/compiler/src/rec_env.erl:-type environment() :: [mapping(),...].</font></div>
<div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type iapply() :: #iapply{}.</font></div><div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type ibinary() :: #ibinary{}.</font></div>
<div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type icall() :: #icall{}.</font></div><div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type icase() :: #icase{}.</font></div>
<div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type icatch() :: #icatch{}.</font></div><div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type iclause() :: #iclause{}.</font></div>
<div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type ifun() :: #ifun{}.</font></div><div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type iletrec() :: #iletrec{}.</font></div>
<div><font face="'courier new', monospace">./lib/compiler/src/v3_core.erl:-type imatch() :: #imatch{}.</font></div><div><font face="'courier new', monospace">…</font></div>
</blockquote><div><br></div><div>From there redirect to a file or run it for further processing through an awk script and you've got a list of all types and function specifications in the entire distribution arranged however you like it.</div>
<br><div class="gmail_quote">On 26 October 2011 10:31, Gary Hai <span dir="ltr"><<a href="mailto:gary@xl59.com" target="_blank">gary@xl59.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>Hi all,</div><div><br></div><div>I am eager for a full list of all built-in types and function specifications as reference manual for erlang coding. The erlang reference manual ( <a href="http://www.erlang.org/doc/reference_manual/typespec.html" target="_blank">http://www.erlang.org/doc/reference_manual/typespec.html</a>) of type specs page does not include OTP module, so I think it is not a full list.</div>
<br>Thanks,<div><br><font color="#888888"><div>Gary</div></font></div></div><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot."<br>
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.<br>
</blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot."<br>
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.<br>
</div>
</blockquote></div><br></body></html>