[erlang-questions] Why do we need modules at all?

Tim Watson watson.timothy@REDACTED
Wed May 25 11:26:17 CEST 2011


>
> Very interesting idea - there was once a pascal pretty printer that analysed
> your code
> and inferred the style that you preferred - "Umm this guy likes semi-colons
> at the end of
> line ..." they in applied it to code you hadn't written.

<grin>


>> >> I'm guessing this will require patching the compiler to preserve the
>> >> type specs in the beam code. That is something I would need help with,
>> >> but may be trivial for others.
>> >
>> > Easy - it is there already (I think) poke around in beam_lib.erl
>> > this analyses the .beam files.
>> >
>>
>> I was pretty sure this wasn't the case. I'll dig in to beam_lib at
>> lunch time and have another look.
>
>

So you're sort of correct. The specs are present in the abstract_code
chunk. I'm guessing this will only be the case if (a) you've compiled
with debug_info and/or (b) you've used the abstract_code
parse_transform (from github?) to ensure it's present either way. You
would need to make sure it is preserved in order to get the type info
by inspecting the beam. Perhaps slurping dialyzers generated plt
file(s) would be a better (more general) approach? Maybe we should
talk to Kostis - I suspect the idea of a type-based search engine
might whet his appetite somewhat.



More information about the erlang-questions mailing list