[erlang-questions] Funargs: Ruby-like blocks for Erlang

Nahuel Greco ngreco@REDACTED
Fri Jul 22 18:10:28 CEST 2011

On Fri, Jul 22, 2011 at 4:55 AM, Joe Armstrong <erlang@REDACTED> wrote:
> On Fri, Jul 22, 2011 at 6:28 AM, Richard O'Keefe <ok@REDACTED> wrote:
> I have three javascript books at home - I looked up assignment in all three.
> But none of them said anything sensible ...
> What does
>     x = y;
> mean in javascript?
> If I say
>     x = y;
> In javascript and then change y, is x changed? Or if I change x is
> y changed.

Javascript books are terrible, you really need to study the ECMA-262
document to get it. Closures in JS doesn't bind the values of the
outer lexical context variables when they are created. Instead, they
keep a reference to the outer scope frame. So when you execute the
closure, there is a level of indirection to the value not present in
Erlang. Inside the closure you are really doing something like
outer_scope['x'] = y;

Nahuel Greco

More information about the erlang-questions mailing list