> 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
a...@rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to