Arguments instantiation by destructuring assignment has no effect on June 15 draft

Yusuke Suzuki utatane.tea at gmail.com
Sun Jun 24 05:03:22 PDT 2012


Arguments instantiation by destructuring assignment has no effect on June
15 draft

Hello everyone,

I'm now implementing ES.next engine in ES5.1 and I may find issue on
current draft.

In June 15 draft, to realize destructuring assignment in FormalParameters,
we perform Binding Initialisation for formals with Arguments object.

In section 10.5.3, step 8-d,

>    d. Let formalStatus be the result of performing Binding Initialisation
for formals with ao and undefined as arguments.

But, ao.[[Get]], ao.[[GetOwnProperty]] have been already overriden to
mapped arguments special internal methods in non-strict function.

For example,

function test(a) { }
test(10);

In this script, we perform Indexed Binding Initialisation and finally, we
perform ao.[[Get]]('a').
But, in this phase, 'a' entry of environmental record is initialized to
undefined in 10.5.3-5-c-ii-1, so ao's getter defined in
CreateMappedArgumentsObject step 7-c-ii-2,

function () { return a; }

always returns undefined.
As the result, ao.[[Get]] result is always undefined, and we cannot
initialize argument by correct value.

I think it is issue of current draft, is it right?

To fix this, I suggest creating JS Array from argumentsList and performing
Binding Initialisation with it, or delaying internal method override phase
of ao.

Regards,
Yusuke Suzuki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120624/4a07dd55/attachment.html>


More information about the es-discuss mailing list