return when desugaring to closures

Yuh-Ruey Chen maian330 at gmail.com
Fri Oct 10 19:22:45 PDT 2008


David Herman wrote:
> > My question was whether the semantics of break and continue would
> > support the following:
>
> Yes, this is another good case to consider. Thanks for pointing it out; I'll add this to the strawman:lambdas proposal. Essentially this is another aspect of the semantics of 'function' that is implicit -- that it cancels out the scope of break/continue labels -- and it's precisely these implicit elements of a language feature that break expected equivalences. (They are essentially "unhygienic" -- if you push me, I can explain the connection to macros.)
>   

First off, I'm really glad that "clean" functions are being considered
for ES-Harmony - another step toward hygienic macros!

I read through the strawman:lambdas proposal and saw that it did not
mention anything about |var|, e.g.

(function() {
    lambda {
       var x = 10;
    }();
    return x;
})()

Does the |var| within the lambda define a var in the function body, and
does that var declaration hoist to the top of the function body?


More information about the Es-discuss mailing list