On Tue, Dec 15, 2009 at 04:16:11PM +0100, Vlad Dumitrescu wrote: > 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. >
Yes, Wrangler uses a modified version of the standard scanner and erl_prettypr, so that the original program layout can be preserved as much as possible. Splitting the infrastructure part of Wrangler into a separate library is one of the things we plan to do; I will look into this in January. Regards, Huiqing ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Erlide-devel mailing list Erlide-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/erlide-devel