[erlang-questions] metaprogramming with -spec

Vlad Dumitrescu vladdu55@REDACTED
Fri Sep 19 14:56:47 CEST 2014


See also http://erlang.org/pipermail/erlang-questions/2011-March/056896.html


On Fri, Sep 19, 2014 at 2:52 PM, Vlad Dumitrescu <vladdu55@REDACTED> wrote:

> On Fri, Sep 19, 2014 at 2:33 PM, semmit mondo <semmitmondo@REDACTED>
> wrote:
>
>>
>> Is it possible to figure out the spec of functions in a compiled module?
>>
>> Given a module name I want to be able to know what is the return type
>> of a function in that module and what are the types of the arguments.
>> But all I know at the moment is the arity of the function (via
>> module_info).
>> Is that info lost when compiling?
>>
>
> If the module was compiled with debug info, then you can call
> beam_lib:chunks(Module, [abstract_code]) and traverse the result looking
> for the spec attributes.
>
> I would have expected that the specs would be listed in the 'attributes'
> chunk, but it looks that they aren't. Is there a reason for that?
>
> regards,
> Vlad
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140919/f1897f48/attachment.htm>


More information about the erlang-questions mailing list