<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body 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>
<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>
...]<br>
<br>
<br>
<div class="moz-cite-prefix">On 04/10/2015 08:41 AM, Vlad Dumitrescu
wrote:<br>
</div>
<blockquote
cite="mid:CAA-EFXvAiJLnfHKkQnP+cKVMmRYDB94Ji7a=iwUyr=qpsi4jfg@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a moz-do-not-send="true"
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>
</body>
</html>