(Almost) everything is expression
Axel Rauschmayer
axel at rauschma.de
Fri Nov 11 02:52:11 PST 2011
> which I thought could be turned into:
> -----
> var C = {
> let something;
>
> // |this| is the global object
> // ...
> }
> -----
>
> But it does not have a return value and as noted in your second message, there seems to be an ambiguity with object initializers (not only visual but formal).
> The 'do expressions' solution sounds like a good idea, but visually reminds of a do-while loop.
>
> I don't really have a better proposition yet, but i'm looking forward to seeing any solution that will allow to replace all "(function(global){...})(this);"
IIRC: Block lambdas.
var C = {|| // note the double pipe
let something;
// |this| is the global object
// ...
return something;
}
With a single expression, you don’t even have to return:
var C = {|| // note the double pipe
foo()
}
--
Dr. Axel Rauschmayer
axel at rauschma.de
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
More information about the es-discuss
mailing list