ArrayCreate should use the default [[DefineOwnProperty]] internal method instead of Array's
# Allen Wirfs-Brock (13 years ago)
this also should be reported to bugs.ecmascript.org
This is a very good catch.
this also should be reported to bugs.ecmascript.org This is a very good catch. Allen On Jun 24, 2012, at 6:45 AM, Yusuke Suzuki wrote: > Hello everyone, > > In 15.4 ArrayCreate algorithm step 7, we use [[DefineOwnProperty]] of A. > > Call the [[DefineOwnProperty]] internal method of A with arguments "length", Property Desciptor {[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}, and false. > > ArrayCreate set A's [[DefineOwnProperty]] to 15.4.5.1 method in step 4, so step 7 calls 15.4.5.1 Array's [[DefineOwnProperty]]. > > Array's [[DefineOwnProperty]] assumes that 'length' property is always set. Seeing 15.4.5.1 step 1 > > Let oldLenDesc be the result of calling the [[GetOwnProperty]] internal method of A passing "length" as the argument. The result will never be undefined or an accessor descriptor because Array objects are created with a length data property that cannot be deleted or reconfigured. > > But, in ArrayCreate phase (step 7), A's 'length' property is not set yet. Then assertion in 15.4.5.1 step 1 always fails. > > So we should use the default [[DefineOwnProperty]] internal method instead of Array's. > I suggest modifying ArrayCreate step 7, > > Call the default [[DefineOwnProperty]] internal method (8.12.9) on A with arguments "length", Property Desciptor {[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}, and false. > > 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/ced92365/attachment-0001.html>
# Yusuke Suzuki (13 years ago)
Thanks for your reply. I filed this issue to bugs.ecmascript.org https://bugs.ecmascript.org/show_bug.cgi?id=415 Regards, Yusuke Suzuki On Sun, Jun 24, 2012 at 11:59 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote: > this also should be reported to bugs.ecmascript.org > > This is a very good catch. > > Allen > > > > On Jun 24, 2012, at 6:45 AM, Yusuke Suzuki wrote: > > Hello everyone, > > In 15.4 ArrayCreate algorithm step 7, we use [[DefineOwnProperty]] of A. > > Call the [[DefineOwnProperty]] internal method of A with arguments >> "length", Property Desciptor {[[Value]]: length, [[Writable]]: true, >> [[Enumerable]]: false, [[Configurable]]: false}, and false. > > > ArrayCreate set A's [[DefineOwnProperty]] to 15.4.5.1 method in step 4, so > step 7 calls 15.4.5.1 Array's [[DefineOwnProperty]]. > > Array's [[DefineOwnProperty]] assumes that 'length' property is always > set. Seeing 15.4.5.1 step 1 > > Let oldLenDesc be the result of calling the [[GetOwnProperty]] internal >> method of A passing "length" as the argument. The result will never be >> undefined or an accessor descriptor because Array objects are created with >> a length data property that cannot be deleted or reconfigured. > > > But, in ArrayCreate phase (step 7), A's 'length' property is not set yet. > Then assertion in 15.4.5.1 step 1 always fails. > > So we should use the default [[DefineOwnProperty]] internal method instead > of Array's. > I suggest modifying ArrayCreate step 7, > > Call the default [[DefineOwnProperty]] internal method (8.12.9) on A with > arguments "length", Property Desciptor {[[Value]]: length, [[Writable]]: > true, [[Enumerable]]: false, [[Configurable]]: false}, and false. > > 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/20120625/939a36f0/attachment.html>
Hello everyone,
In 15.4 ArrayCreate algorithm step 7, we use [[DefineOwnProperty]] of A.
Call the [[DefineOwnProperty]] internal method of A with arguments
ArrayCreate set A's [[DefineOwnProperty]] to 15.4.5.1 method in step 4, so step 7 calls 15.4.5.1 Array's [[DefineOwnProperty]].
Array's [[DefineOwnProperty]] assumes that 'length' property is always set. Seeing 15.4.5.1 step 1
Let oldLenDesc be the result of calling the [[GetOwnProperty]] internal
But, in ArrayCreate phase (step 7), A's 'length' property is not set yet. Then assertion in 15.4.5.1 step 1 always fails.
So we should use the default [[DefineOwnProperty]] internal method instead of Array's. I suggest modifying ArrayCreate step 7,
Call the default [[DefineOwnProperty]] internal method (8.12.9) on A with arguments "length", Property Desciptor {[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}, and false.
, Yusuke Suzuki