recursive arrow functions

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Apr 1 08:59:58 PDT 2012


On Apr 1, 2012, at 7:59 AM, Brendan Eich wrote:

> Kevin Smith wrote:
>> This is the workaround, right?
>> 
>>    const recurse = () => {
>>        // call recurse(), somehow...
>>    };
> 
> Yes, with the hassle of hoisting from an expression out to enclosing block or body scope, and of polluting that scope with the name (long-form named function expressions avoid this).

> 
>> If so, then it seems hardly worth any added parsing complexity to support named arrows.
> Could be.


or:
  (do {let recurse = () => {
             //call recurse(), somehow ...
            };
           recurse
         }
   )
    
Plus, if we can define const and let to have completion values, we can get rid of the extra reference to recurse.

Allen





> 
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 



More information about the es-discuss mailing list