Self-recursion and arrow functions

Rick Waldron waldron.rick at
Sun Mar 17 17:49:49 PDT 2013

On Sun, Mar 17, 2013 at 7:10 PM, Jorge Chamorro <jorge at>wrote:

> On 17/03/2013, at 14:33, Mark S. Miller wrote:
> > Just in case anyone does not realize that this thread is humorous,
> >
> >     const factorial = n => n>1 ? n*factorial(n-1) : 1;
> >
> > Yes, you can't use this as an expression. So what? After this
> declaration you can use factorial as an expression.
> IIRC the possibility of *simply* using 'ƒ' (instead of 'function') for
> lambdas, which is a syntax that's immediately familiar to any JS developer:
> [1,2,3,4,5,6].map(ƒ factorial(n) { n>1 ? n*factorial(n-1) : 1 });

This road is a dead end—previously proposed by Axel last year and Brendan 3
years ago (I can't spend anymore time going further back to see if it
appeared prior to that)

...which you backed:

...but François Remy's concerns still stand:

...and Brendan's point about backwards compatibility is irrefutable:

As promised, three years ago, Brendan proposes here:

And kills it himself here:


> But Brandon Benvie was pointing out at the problem: "Relying on the
> defined name they're assigned to suffers from the "can be redefined"
> problem":
> var factorial= (n)=> n>1 ? n*factorial(n-1) : 1;

use const?

> The factorial lambda above depends on a free var to function properly
> which is a hazard.
> It never ocurred to me that using const instead of var/let as you've done
> above fixes that, thank you!
> Still, ƒ named lambdas have the advantage that can be used directly as
> expressions, without going through any const roundabouts.

But they aren't part of ES6 and Arrow Functions are; if you need a named
function expression, then use a named function expression, they aren't
going anywhere.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list