Self-recursion and arrow functions
jason.orendorff at gmail.com
Sat Mar 16 16:51:02 PDT 2013
The meeting notes say:
> arrows can't have intrinsic names (contrast with NFEs) so arguments.callee
> may be wanted, so arrows should not be strict-only.
I'm glad this is going away. I share Alex's skepticism over this particular
motive. But just generally it was going to be a little bizarre and
astonishing for users, the implicit strictness.
Separately, a funny story about that auto-strictness: Since we currently
enforce strictness SyntaxErrors in the initial parse pass, and arguments
can contain default values which are arbitrary JS expressions, I had
implemented arrow functions by rewinding the state of the token stream to
the beginning of the arguments after the => token was reached, and just
re-parsing the whole thing as a function. (I know, I know, I've forefeited
my hacker's license.)
Functions with default arguments have the same weird problem. You can still
do it in one pass, but you have to track "this
parameter-default-value-expression contains code that would not be allowed
if the enclosing function turns out to be strict". You won't know that it's
strict until you see the "use strict" directive which is in the function
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss