Array construction underspecified

Mark S. Miller erights at google.com
Thu Jan 15 15:57:41 PST 2009


I see that the spec for constructing an array from an array literal has been
clarified to ensure that, even if Array.prototype[3] is an accessor
property, that it's setter is not invoked to initialize the corresponding
element of the array. (This issue didn't arise in ES3 since it had no
accessor properties.)

However, the old unmodified text in 15.4.2.1 is

The length property of the newly constructed object is set to the number of
> arguments.
> The 0 property of the newly constructed object is set to item0 (if
> supplied); the 1 property of the
> newly constructed object is set to item1 (if supplied); and, in general,
> for as many arguments as there
> are, the k property of the newly constructed object is set to argument k,
> where the first argument is
> considered to be argument number 0.
>

This doesn't explain how these properties are set, but probably need to for
the same reason. As with array literals, I think this should directly define
data properties, ignoring potentially inherited accessors.

-- 
   Cheers,
   --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090115/bed76b2e/attachment.html>


More information about the Es-discuss mailing list