Can an Array have array indexed accessor properties and other curiosities??
Mark S. Miller
erights at google.com
Sun Feb 15 10:27:21 PST 2009
On Fri, Feb 13, 2009 at 7:12 PM, Breton Slivka <zen at zenpsycho.com> 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
> 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?
>> 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
> 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
More information about the Es-discuss