On Fri, Feb 13, 2009 at 7:12 PM, Breton Slivka <[email protected]> wrote:
>> Here's another one. What happens if the length field is set [[Writable]]:
>> false and an attempt is subsequently make to define an array indexed
>> property (using either [[Put]] or Object.defineProperty) whose name is >=
>> than length? I suggest it fails (silently or not depending upon the Throw
>> parameter).
>
> I like this. It means you can make essentially fixed length arrays.
> Perhaps there is even room for implementation optimisation here if the
> user does this?
Good point.
>> What happens if the length is explicitly reduced such that an array indexed
>> property that is [[Configurable]]: false would be deleted by the ES3 array
>> [[Put]] algorithm? Alternatives:
>>
>> 1) The undeletable property is left undisturbed. (This
>> tosses out the ES3 invariant that length is > than the name of any array
>> indexed own properties.
>>
>> 2) The redefinition of length fails (silently or not
>> depending upon the Throw parameter).
>>
>> My preference is #1. #2 might be more consistent with my read-only length
>> recommendation but I'm concern that it requires implementations to use a two
>> pass algorithm to ensure atomicity. I'd prefer that not to impose that on
>> implementers.
>
> what if you had #1, but the length property, rather than being set to
> the new value, gets set to the index of the last undeletable property
> + 1. That's what I would expect to happen.
Good. My proposed #3 is in agreement with this modulo the issue of
whether it throws. I should have specified that it throws conditional
on the Throw parameter (i.e., only if the assignment appears in strict
code).
--
Cheers,
--MarkM
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss