Arguments instantiation has no effect on June 15 draft

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Jun 24 07:50:15 PDT 2012


Yes, please file a bug report at bugs.ecmascript.org

As you suggest, the straight forward way to specify this is probably to use a normal array for the actual argument values for Binding Initialisation of the formals rather than trying to use the arguments object for that purpose.   Of course, that doesn't mean that the additional array actually has to be created at runtme, it will just be a specification device.

Allen


On Jun 24, 2012, at 5:11 AM, Yusuke Suzuki wrote:

> 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
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120624/7ee22d10/attachment.html>


More information about the es-discuss mailing list