On Sun, Mar 17, 2013 at 7:10 PM, Jorge Chamorro <[email protected]>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)
https://mail.mozilla.org/pipermail/es-discuss/2012-January/019852.html
...which you backed:
https://mail.mozilla.org/pipermail/es-discuss/2012-January/019857.html
...but François Remy's concerns still stand:
https://mail.mozilla.org/pipermail/es-discuss/2012-January/019864.html
...and Brendan's point about backwards compatibility is irrefutable:
https://mail.mozilla.org/pipermail/es-discuss/2012-January/019860.html
As promised, three years ago, Brendan proposes here:
https://mail.mozilla.org/pipermail/es-discuss/2010-April/011010.html
And kills it himself here:
https://mail.mozilla.org/pipermail/es-discuss/2010-April/011034.html
snip
> 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.
Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss