[Arrow function syntax] Move Arrow to head to fix ArrowFormalParameters issues

Sean Eagan seaneagan1 at gmail.com
Wed Jun 1 11:29:56 PDT 2011


Good point, the Identifier + ArrowFormalParameters would be ambiguous
with a function call.  That could be fixed though by just putting the
Identifier before the Arrow:

higher( fact -> (n) n<=1 ? 1 : n * fact(n-1));

var warmer -> (a) {...};
let warm -> (b) {...};
const colder -> (c) {...};
const #coldest -> (d) {...};

On Wed, Jun 1, 2011 at 11:15 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
> one thing that stands out in your proposal is that there doesn't appear to be any way to write a recursive arrow function.
>
> Here is one way it might be done:
>
> higher(->: fact (n) n<=1?1:n*fact(n-1));
>
> or possibly
>
> higher(->@ fact (n) n<=1?1:n*fact(n-1));
>
> (in either case the 3 character arrow sequence would be one token)
>
>



Thanks,
Sean Eagan


More information about the es-discuss mailing list