[erlang-questions] Reassigning variables
Tony Arcieri
tony@REDACTED
Wed Mar 18 03:32:24 CET 2009
On Tue, Mar 17, 2009 at 5:51 PM, Adam Kelly <cthulahoops@REDACTED> wrote:
> Looking through your parse transform code it strikes me how few
> functions you are using. This is a functional programming language
> and all the meat of your parse transform is in one function. I'm not
> surprised that you keep wanting to reassign variables in this case. [...]
>
In 20,000 lines of Erlang, I think I've used numbered variables once.
> (And that needs refactoring!)
>
If you like to scrutinize people who suggest destructive assignment is an
"interesting feature" by the code they implement to support it on top of
Erlang, I'd sure be interested in what you make of mine:
http://github.com/tarcieri/reia/blob/master/src/compiler/reia_ssa.erl
The main problems I see are: it's highly repetitive, and is also filled with
lots of numbered variables. It's also not passing state around correctly as
I tried to retrofit records into it after managing the transform state with
tuples became too unwieldy. I'm sure there's probably a better general
solution to statefully walking around trees and transforming them in
general. Right now what I'm doing is pretty slow.
Any suggestions (or patches :) are welcome.
--
Tony Arcieri
medioh.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090317/b6a841a4/attachment.htm>
More information about the erlang-questions
mailing list