Self-recursion and arrow functions

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Mar 16 16:12:39 PDT 2013


If you need to name an arrow function you can use let or const and reference the name both within body and use it as an argument expression.

regarding using 'arguments' within arrow functions, I would be sympathetic if somebody wanted to argue that arrow functions should treat 'arguments' similar to this and super and not local rebind its meaning.

However, I would also anticipate some implementor push back on that as I suspect that implementations aren't current set up to uplevel access 'arguments'

Allen





On Mar 16, 2013, at 3:19 PM, Axel Rauschmayer wrote:

> OK. Thankfully, with `super`, an important use case for a function referring to itself goes away (AFAIK, `super` keeps qooxdoo and Ember in non-strict mode, they need arguments.callee).
> 
> On Mar 16, 2013, at 23:12 , Brendan Eich <brendan at mozilla.com> wrote:
> 
>> I wouldn't overreact. My note was simply that we should not make arrows strict by definition, and TC39 agreed. Among the "folk wisdom" reasons for avoiding strict is to have arguments.callee, but of course NFEs should be preferred in modern engines. But there's no arrow NFE form.
>> 
>> /be
>> 
>> Brandon Benvie wrote:
>>> I think this is a better argument for introducing a new primitive for referencing the current function than for resurrecting arguments.
>>> 
>>> On Mar 16, 2013, at 2:29 PM, Axel Rauschmayer <axel at rauschma.de <mailto:axel at rauschma.de>> wrote:
>>> 
>>>> Quoting Brendan Eich in [1]:
>>>> 
>>>>> arrows can't have intrinsic names (contrast with NFEs) so arguments.callee may be wanted, so arrows should not be strict-only.
>>>> 
>>>> Is this really an option? Sounds messy. Like a carrot to go back to non-strict. I’d either allow arguments.callee in both modes. Or introduce a new mechanism for a function to refer to itself. I thought that `arguments` would disappear from JavaScript code over time so the latter alternative seems better.
>>>> 
>>>> Axel
>>>> 
>>>> [1] https://github.com/rwldrn/tc39-notes/blob/master/es6/2013-01/jan-30.md
>>>> 
>>>> -- 
>>>> Dr. Axel Rauschmayer
>>>> axel at rauschma.de <mailto:axel at rauschma.de>
>>>> 
>>>> home: rauschma.de <http://rauschma.de>
>>>> twitter: twitter.com/rauschma <http://twitter.com/rauschma>
>>>> blog: 2ality.com <http://2ality.com>
>>>> 
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>> 
> 
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de
> 
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130316/716ea2c1/attachment-0001.html>


More information about the es-discuss mailing list