On 01/06/2013, at 23:49, Axel Rauschmayer wrote:
> 
> On Jun 1, 2013, at 14:38 , Jorge <jo...@jorgechamorro.com> wrote:
>> 
>> How would this:
>> 
>> (Function () {
>> 
>>  // ...
>> 
>> })();
>> 
>> now look like with arrow functions?
>> 
>> (()=>{
>> 
>>  // ...
>> 
>> })();
>> 
>> What can be left out, if anything?
>> 
> 
> You’ll rarely, if ever, need IIFEs with ES6, thanks to block-scoped function 
> declarations and for-of (which creates a fresh copy of the iteration variable 
> for each iteration).
> 
> Thus, instead of:
> 
> (function () {
>     var tmp = …;
> }());
> 
> you can do:
> 
> {
>     let tmp = …;
> }
> 
> I’d still love to have do-blocks, though.

But they're not fully interchangeable, for example I can exit a function at any 
point with a return, but can I exit a block at any point with a break or 
something? Also a function returns a value, does a block evaluate to something?

In any case, I would really like to know which parenthesis or curly braces can 
I leave out in an immediately invocated arrow function expression, for example 
this:

var x= (=>{
  //...
})();

Is it correct ES6? Is there anything else that I could rmv in that IIAFE?

Thank you!
-- 
( Jorge )();
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to