New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.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

Open
isiahmeadows opened this Issue Oct 11, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@isiahmeadows

isiahmeadows commented Oct 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 true and 0 ≤ ToUint32(P) < 231. There are a few primary uses, but they all seem questionable:

  • In 9.4.2 Array Exotic Objects, it specifies that array exotic objects give special treatment to array indices but in every Array prototype method, ToLength is used instead, which constrains only to integer index property keys, by constraining the number to +0 ≤ ToNumber(P) < 253.
  • In 9.4.4 Arguments Exotic Objects, it specifies that they have own array index properties, but the only internal operation that'd use this.length is the arguments[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 touch arr.length, but it cause arr.length to be set to 2**53 after this change. The rest is just informative changes in each of these linked sections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment