[erlang-questions] prettypr and spec
Wed Sep 26 00:48:36 CEST 2012
Someone really should fix the bugs in erl_prettypr.
Ulf Wiger, Feuerlabs, Inc.
25 sep 2012 kl. 22:31 skrev Roberto Ostinelli <>:
> Thank you Ulf,
> I've looked at this and it reads from .beam files. Same problem as before: as specified I need to parse string() code.
> Do I really have to write my own erlang indenter? That really seems weird. Isn't there such a thing like a DSL for indenters?
> On Tue, Sep 25, 2012 at 1:34 AM, Ulf Wiger <> wrote:
>> It appears as if erl_pp:form/1 does a much better job of formatting specs,
>> but then, of course, you lose the comments.
>> There is also an issue with typed record fields, which seems to affect
>> erl_prettypr as well. It simply removes the types from record declarations.
>> Take a look at parse_trans_pp:beam/1. It makes no effort to preserve comments
>> (naturally, since it doesn't expect to find any), but handles specs and typed
>> records correctly.
>> This module, BTW, is also made to be used as an escript, and I have the
>> following convenient alias:
>> alias pp='escript /Users/uwiger/git/parse_trans/ebin/parse_trans_pp.beam'
>> Not that the last point was particularly relevant to your particular problem. :)
>> Ulf W
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions