Are array 'length' properties really configurable?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Are array 'length' properties really configurable?

Jim Blandy-3
Given that 15.4.5.2 makes arrays' length properties non-configurable, it
seems to me that all the care taken in step three of the custom
[[DefineOwnProperty]] method in 15.4.5.1 is to no avail, as the default
[[DefineOwnProperty]] will refuse to make any changes anyway.

I've filed a Trac ticket for this:
http://bugs.ecmascript.org/ticket/473

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Are array 'length' properties really configurable?

Allen Wirfs-Brock-2
(this should probably have been posted to es5-discuss rather than es-discuss)

Most of the work in 15.4.5.1 step 3 is about maintaining array length invariants  that are outside the scope of the default [[DefineOwnProperty]] specification.  Specifically, the Uint32-ness of the length value and the possible removal of array elements when the length is reduced.  Those would have to be specified regardless of whether the length property was configurable or not.  The only additional attribute analysis that I see is related to the possibility of changing [[Writable]] for length from true to false.  That change is permitted, even if [[Configurable]] is false.  Some of the extra work is there to accommodate the possibility that that when deleting element for a length reduction we encounter a non-deletable array element and that causes the length to snap to that index (+1).  We can't set [[Writable]] to false until we are sure what the final length value will be.

Are there some specific sub-steps of  step 3 that you think are unnecessary?

Allen

> -----Original Message-----
> From: [hidden email] [mailto:es-discuss-
> [hidden email]] On Behalf Of Jim Blandy
> Sent: Wednesday, August 25, 2010 11:49 AM
> To: es-discuss
> Subject: Are array 'length' properties really configurable?
>
> Given that 15.4.5.2 makes arrays' length properties non-configurable, it seems
> to me that all the care taken in step three of the custom [[DefineOwnProperty]]
> method in 15.4.5.1 is to no avail, as the default [[DefineOwnProperty]] will
> refuse to make any changes anyway.
>
> I've filed a Trac ticket for this:
> http://bugs.ecmascript.org/ticket/473
>
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Are array 'length' properties really configurable?

Jim Blandy-3
On 08/25/2010 12:30 PM, Allen Wirfs-Brock wrote:
> (this should probably have been posted to es5-discuss rather than es-discuss)
>
> Most of the work in 15.4.5.1 step 3 is about maintaining array length invariants  that are outside the scope of the default [[DefineOwnProperty]] specification.  Specifically, the Uint32-ness of the length value and the possible removal of array elements when the length is reduced.  Those would have to be specified regardless of whether the length property was configurable or not.  The only additional attribute analysis that I see is related to the possibility of changing [[Writable]] for length from true to false.  That change is permitted, even if [[Configurable]] is false.  Some of the extra work is there to accommodate the possibility that that when deleting element for a length reduction we encounter a non-deletable array element and that causes the length to snap to that index (+1).  We can't set [[Writable]] to false until we are sure what the final length value will be.
>
> Are there some specific sub-steps of  step 3 that you think are unnecessary?
>    
I think this was my misunderstanding.  If I'm reading the default
[[DefineOwnProperty]] algorithm correctly, it permits [[Writable]] to go
from true to false (but not from false to true) even when
[[Configurable]] is false. That's not what I had expected. Now 15.4.5.1
step 3 makes more sense to me.

Thanks for the help.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss