[erlang-questions] metaprogramming with -spec
Fri Sep 19 14:52:09 CEST 2014
On Fri, Sep 19, 2014 at 2:33 PM, semmit mondo <semmitmondo@REDACTED>
> 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
> 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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions