Continuing woes in reading the ES6 spec language

Oliver Hunt oliver at apple.com
Thu Sep 12 12:45:38 PDT 2013


On Sep 12, 2013, at 12:40 PM, Jason Orendorff <jason.orendorff at gmail.com> wrote:

> Just as a worked example, answering Oliver's question about default
> expressions took me the better part of an hour.
> 
> The default-expression h() in code like
> 
>    function f(x=h(), y) {
>        function h() { ... }
>    }
> 
> is evaluated in the scope of f, as I expected, so {x, h, y} are all in
> scope there.
> 
> But I was surprised by the timing; h() is evaluated
> (a) before y is populated with the actual argument value;
> (b) before the arguments object is fully initialized.
> 
> That last surprise seems really unfortunate, since the expression can
> access the arguments object, observing it before and after
> CompleteMapped/StrictArgumentsObject, or even cause those to fail. Can
> we change that?
>From talking to SpiderMonkey folk it sounds like SM nukes the |arguments| identifier entirely if you use any of the new parameter logic (deconstruction, defaults, or rest params).  I would be happy with that.

The spec (from my understanding) says that we can't declare a parameter named arguments but does limit reads of it.  Also that doesn't limit declarations of a local named arguments 

--Oliver


More information about the es-discuss mailing list