soure->source Xformer

Richard Carlsson richardc@REDACTED
Tue Sep 23 13:09:31 CEST 2003


On Tue, 23 Sep 2003, Joe Armstrong wrote:

>   Has anybody (Luke?, Robert?) got a source->source Erlang transformer
> that expand out
>
> 	- records
> 	- funs
> 	- list-comprehensions
> 	- if/case/receive
>
> This is prettry similar to erl_lint + sys_pre_expand only brought
> up-to-date for list-comprehensions and records.

sys_pre_expand already *does* expand away records and list
comprehensions (do "c(foo, ['E'])." and look at the "foo.E" file).

Adding a pass to expand ifs to normal cases should be simple (there used
to be a template parse transform file somewhere - under stdlib I think -
but I can't find it in the current distribution). Or just hack
sys_pre_expand to do it for you - it should not make any difference
if it is done there or later (well, the debugger could be confused).

Funs should _not_ be "expanded" however, as long as you're still on this
level - it's a *big* mistake to expose the actual implementation of
closures until you get to the really low level code.

	/Richard


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list