Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up9.4.2 states array objects' indexed properties are always array indices, but they're only coerced to integer indices in all the array prototype methods #1329
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
isiahmeadows commentedOct 11, 2018
In 6.1.7 The Object Type, it states that array indices are integer indices where for each P, SameValue(ToString(ToUint32(P)), P) is
trueand 0 ≤ ToUint32(P) < 231. There are a few primary uses, but they all seem questionable:this.lengthis thearguments[Symbol.iterator] === Array.prototype.values, which itself uses ToLength.Shouldn't the these be updated to just use integer indices instead, with all uses of "array index" removed (excluding the bit in Annex D, where it's clear from context)?
Note that this would involve a single normative change in 9.4.2.1, since
Object.defineProperty(arr, 2**53-1, {value: 0})currently doesn't toucharr.length, but it causearr.lengthto be set to2**53after this change. The rest is just informative changes in each of these linked sections.