ecma262 icon indicating copy to clipboard operation
ecma262 copied to clipboard

Editorial: Replace terms "integer index" and "array index"

Open jmdyck opened this issue 6 years ago • 14 comments

The problem with "integer index" and "array index" (defined in 6.1.7 The Object Type) is that they are terms for String values, and yet pretty much everything else in the spec (and a lot of usage outside the spec) assumes that an index is an integer value.

The term "integer index" is worse, because both words mislead the reader to think that this is an integer value. And there's a danger that someone can use the term in the natural sense of "an index that's an integer" without realizing that that conflicts with the given definition. In fact, this has happened in the current spec, where about half of the uses of "integer index" actually refer to an integer value: see step 14.c.i in String.prototype.split and the descriptions of all the [[FooNextIndex]] slots.

So I propose the following renaming:

  • "integer index" -> "Uint53-string"
  • "array index" -> "Uint32-string"

Rationale for the new terms:

  • It's clear we're talking about a String value.
  • But it's also fairly clear that they are related to unsigned integers, based on the "Uint32" terminology the spec already uses.
  • And the "53" vs "32" makes explicit the distinction between two: the range of permissible values (which "integer" vs "array" doesn't really convey).

(Of course, I didn't convert the uses of "integer index" that weren't using it in the defined sense.)


The spec also used the terms "integer-indexed" and "array-indexed", but didn't define them or use them entirely consistently, so I added definitions for "Uint53-indexed" and "Uint32-indexed" and tried to be consistent in their usage.

(But I left "Integer-Indexed exotic objects".)


Effect on downstream specs:

  • "array index":

    • WebIDL uses "array index" in ES's sense, but defines its own abstract operation for "property name P is an array index", so it wouldn't have to change due to this PR. (It could if its editors wanted.)

    • HTML uses the term "array index property name", but refers to WebIDL's definition.

    • Intl doesn't use "array index".

  • "integer index":

    • Neither WebIDL nor HTML use "integer index".

    • Intl has 2 occurrences of "integer index", but not with this meaning, and not linking to ES.

jmdyck avatar Jul 13 '19 02:07 jmdyck

These terms seem more precise, to be sure, but not more clear - why not “integer index String” vs “integer index Number”, etc?

ljharb avatar Jul 13 '19 05:07 ljharb

(force-pushed to resolve a merge conflict)

jmdyck avatar Oct 14 '19 03:10 jmdyck

(force-pushed to resolve a merge conflict /2)

jmdyck avatar Oct 24 '19 00:10 jmdyck

The conclusion from the editor call is that Uint53-string and Uint32-string are not good names. While more clarity could be useful here, until better names are proposed, the churn here is not worth it.

That said, 90f7d8ffac106d8d5311cbfc93c1579531ea3d9d is independent of renaming and is useful in itself. @jmdyck would you like to make a new PR with that commit or morph this PR into just that commit?

syg avatar Nov 14 '19 01:11 syg

While more clarity could be useful here, until better names are proposed, the churn here is not worth it.

Any guidance on your criteria for good names? (These still strike me as good names, so I'm not going to find better ones without a different metric for goodness.)

That said, 90f7d8f is independent of renaming and is useful in itself. @jmdyck would you like to make a new PR with that commit or morph this PR into just that commit?

Done (new PR).

jmdyck avatar Nov 15 '19 00:11 jmdyck

(force-pushed to resolve merge conflicts)

jmdyck avatar Jan 25 '20 18:01 jmdyck

(force-pushed to resolve merge conflicts)

jmdyck avatar Feb 05 '20 04:02 jmdyck

(force-pushed to resolve merge conflicts)

jmdyck avatar Apr 02 '20 15:04 jmdyck

(force-pushed to resolve merge conflicts)

jmdyck avatar Apr 13 '20 18:04 jmdyck

(force-pushed to resolve merge conflicts)

jmdyck avatar Jun 04 '20 02:06 jmdyck

(force-pushed to resolve merge conflicts /8)

jmdyck avatar Oct 16 '20 17:10 jmdyck

(force-pushed to resolve merge conflicts /9)

jmdyck avatar Dec 10 '20 01:12 jmdyck

@jmdyck Just to make sure we're all on the same page: editor group agrees that the existing labels aren't great, but we didn't like the suggestions here and we couldn't come up with any better ones, so this isn't going anywhere until someone comes up with names we like better. You're welcome to keep rebasing if you're inclined to; we just want to make sure you are aware of where the editors are at.

bakkot avatar Feb 17 '21 23:02 bakkot

Yup, that was the impression I had.

jmdyck avatar Feb 18 '21 00:02 jmdyck