Hi!

I've been giving the erl_tidy action (in 'pu') a test drive and it
works almost fine, but there is a bigger problem related to it...
Actually, it's not erl_tidy's problem, but its use of erl_prettypr to
format the output.

More precisely, erl_prettypr can't restore the source code as it was,
and it seems that things like -spec aren't supported at all. For
example,

-spec gg(X::integer(), Y::list()) -> tuple().

becomes

-'spec'({{gg, 2},
         [{type, 9, 'fun',
           [{type, 9, product,
             [{ann_type, 9, [{var, 9, 'X'}, {type, 9, integer, []}]},
              {ann_type, 9, [{var, 9, 'Y'}, {type, 9, list, []}]}]},
            {type, 9, tuple, any}]}]}).

Not to mention that for example 16#22 will be replaced by 34 and other
such ugly things.

Not only that, but tools that rewrite code (like erl_tidy) aren't
aware of the extended syntax tokens and will create "normal" ones
(possibly removing extended info from the original ones). This means
that any replacement for erl_prettypr that we implement must be able
to handle even such tokens. Or that we will have to reimplement all
the tools.

None of that is easy and our final goal must be that these tools will
find their way in the OTP distribution, because maintaining parallel
implementation is not what we should do here. Or at least the OTP
primary implementations should be configurable.

The Wrangler implementation has also an own implementation of a
scanner and (I think) pretty printer. We did talk about splitting that
into a separate library, maybe it's high time to start working at it.

This was just some food for thought, so that we get the discussion started.

best regards,
Vlad

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Erlide-devel mailing list
Erlide-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlide-devel

Reply via email to