Are array 'length' properties really configurable?

Jim Blandy jimb at mozilla.com
Thu Aug 26 01:02:35 PDT 2010


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.



More information about the es-discuss mailing list