On 29 March 2012 22:37, Brendan Eich <[email protected]> wrote: > Andreas Rossberg wrote: > >> I was thinking, it should be possible to extend arrow syntax to allow an >> optional name? As in: >> >> f(n) => n==0 ? 1 : x * f(n-1) >> > > I know you're not proposing, but this would have to be a separate proposal.
I fear adding it to arrow function syntax will lose consensus. Oh yes, definitely. Just thought experiments... > For one thing, the binding forms all have a keyword in front (even formal > parameter and catch variable bindings do). This doesn't. > Not quite: parameters in arrow functions don't either. Currently arrow functions occur as an alternate AssignmentExpression > right-hand side. They are expressions. What you sketched would have to be > produced at statement level to be a declaration, but then it lacks a prefix > keyword and so is harder to see (or perhaps just "inconsistent" in some way > that is foolish to worry about?). Ah, no, I was thinking of this as still being purely an expression, not extending its meaning to be a declaration. That is, the function name is only visible in the body. I completely agree that all declaration statements should start with a keyword. /Andreas
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

