<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 10, 2015 at 10:25 AM, Bengt Kleberg <span dir="ltr"><<a href="mailto:bengt.kleberg@ericsson.com" target="_blank">bengt.kleberg@ericsson.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
When I use beam_lib:chunks/2 I get tuples that are easy to identity
as type information(*).<br>
When I turn the chunks into an abstract tree I do not understand how
to find the type info any more. How should a fun for
erl_syntax_lib:fold/3 look, to identify the type information nodes?<br>
<br></div></blockquote><div><br></div><div>I haven't used that myself, so I don't really know, but if you get tuples that you can use directly, maybe you don't need to call fold.</div><div><br></div><div>/Vlad</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<br>
bengt<br>
(*)<br>
[{attribute,64,type,<br>
{option_name,<br>
{type,64,union,<br>
[{atom,64,use_stdio},<br>
{atom,65,cd},<br>
{atom,66,compressed},<br>
{atom,67,packet},<br>
{atom,68,env},<br>
{atom,69,start_timeout},<br>
{atom,70,call_timeout},<br>
{atom,71,buffer_size}]},<br>
[]}},<br>
...]<div><div class="h5"><br>
<br>
<br>
<div>On 04/10/2015 08:41 AM, Vlad Dumitrescu
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi Bengt,
<div><br>
</div>
<div>You have to extract this information from
beam_lib:chunks(BEAM, [abstract_code]) by means of
erl_syntax_lib:fold/3 to keep only the typespecs. It would be
nice to have a higher-level library that gives access to these
internals.</div>
<div><br>
</div>
<div>regards,</div>
<div>Vlad</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Apr 10, 2015 at 8:23 AM, Bengt
Kleberg <span dir="ltr"><<a href="mailto:bengt.kleberg@ericsson.com" target="_blank">bengt.kleberg@ericsson.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greetings,<br>
<br>
How do I find type information at run time?<br>
<br>
A very nice Erlang module takes an options list. The options
are -type defined and -export_type'ed.<br>
How do another module get that information during run time?<br>
<br>
I thought that it might be in very_nice:module_info(attributes),
but no luck.<br>
<br>
<br>
bengt<br>
<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>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">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></div></div>