I would propose :

return (
   fact@(n) (
       n<=1 ?
       1 :
       n*fact(n-1)
   )
);

Wouldn't that do the trick? I think that the @ char is not allowed in an identifier in ES5, which mean it would not introduce any compatibility issue.



-----Message d'origine----- From: Allen Wirfs-Brock
Sent: Wednesday, June 01, 2011 6:15 PM
To: Sean Eagan
Cc: es-discuss
Subject: Re: [Arrow function syntax] Move Arrow to head to fixArrowFormalParameters issues

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)

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to