[erlang-questions] Reassigning variables

Robert Virding rvirding@REDACTED
Thu Mar 19 01:51:18 CET 2009


2009/3/18 Matthew Dempsky <matthew@REDACTED>

>
> Here's an actual block of code from the Erlang compiler:
>
>    lc_tq(Line, E, [{generate,Lg,P,G}|Qs0], Mc, St0) ->
>        {Gs,Qs1} =  splitwith(fun is_guard_test/1, Qs0),
>        {Name,St1} = new_fun_name("lc", St0),
>        {Head,St2} = new_var(St1),
>        {Tname,St3} = new_var_name(St2),
>        LA = lineno_anno(Line, St2),
>        LAnno = #a{anno=LA},
>        Tail = #c_var{anno=LA,name=Tname},
>        {Arg,St4} = new_var(St3),
>        {Nc,[],St5} = expr({call,Lg,{atom,Lg,Name},[{var,Lg,Tname}]}, St4),
>        {Guardc,St6} = lc_guard_tests(Gs, St5),     %These are always flat!
>        {Lc,Lps,St7} = lc_tq(Line, E, Qs1, Nc, St6),
>        {Pc,St8} = list_gen_pattern(P, Line, St7),
>        {Gc,Gps,St9} = safe(G, St8),                %Will be a
> function argument!
>        Fc = function_clause([Arg], LA, {Name,1}),
>        ....


As the one who wrote the original version of that code (it transforms list
comprehensions to nested recursive functions) I must say I don't really see
the problem. To me it seems more like a theoretical problem, when coding I
just do it. That is not where the problems lay when coding, not for me at
least.

Then maybe I am totally miljöförstörd, ruined by my programming environment.

Robert

P.S. Of course if you were to use LFE then the problem would go away for
free as you have let*. :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090319/4e5774c6/attachment.htm>


More information about the erlang-questions mailing list