geometric memory growth

Matthias Lang matthias@REDACTED
Sat Nov 26 17:40:49 CET 2005


Ulf Wiger writes:

 > Forgive me, but I can't help thinking that an exception
 > when the fun is applied would be the wrong place, rather
 > than when the fun is instantiated.

This seems like madness.

Do you think that f() should print "humpty":

   f() ->
     Y = atom,
     F = fun(X) -> io:fwrite("humpty\n"), X#state.channel end,
     F(Y).

Should g() _always_ cause an exception:

   g() ->
     Y = atom,
     F = fun(X) -> 
           case mymod:myfunc() of
              nice -> nice;
              nasty -> X#state.channel 
           end,
     F(Y).

What about h():

   h() ->
     Y = atom,
     F = fun(X) -> 
           case mymod:myfunc() of
              nice -> nice;
              nasty -> element(3, X)
           end,
     F(Y).

Matthias



More information about the erlang-questions mailing list