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 upMore formal definition of array index #900
Comments
annevk
referenced this issue
Apr 18, 2017
Closed
"array index property name" doesn't guard against failure #346
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
anba
Apr 18, 2017
Contributor
Array index is more formally defined in https://tc39.github.io/ecma262/#sec-object-type.
|
Array index is more formally defined in https://tc39.github.io/ecma262/#sec-object-type. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
That still only defines it for Strings as far as I can tell. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
annevk
Apr 18, 2017
Contributor
For the couple of uses of integer and array index it seems using abstract operations would be much clearer overall.
|
For the couple of uses of integer and array index it seems using abstract operations would be much clearer overall. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rwaldron
Apr 20, 2017
Contributor
From https://tc39.github.io/ecma262/#sec-object-type:
An array index is an integer index whose numeric value i is in the range +0 ≤ i < 232-1.
Did you want something more explicit, eg. with an esid of its own?
|
From https://tc39.github.io/ecma262/#sec-object-type:
Did you want something more explicit, eg. with an |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
annevk
Apr 20, 2017
Contributor
Basically something where https://tc39.github.io/ecma262/#sec-array-exotic-objects-defineownproperty-p-desc step 3 doesn't have a logic error when P is a Symbol and ideally something where you can pass P (even when being a Symbol) to an abstract operation IsArrayIndex() that handles all these details and returns either true or false.
|
Basically something where https://tc39.github.io/ecma262/#sec-array-exotic-objects-defineownproperty-p-desc step 3 doesn't have a logic error when P is a Symbol and ideally something where you can pass P (even when being a Symbol) to an abstract operation IsArrayIndex() that handles all these details and returns either true or false. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
anba
Apr 20, 2017
Contributor
I still don't see where 9.4.2.1 contains a logic error. Array indices are a subset of integer indices, and integer indices are a subset of String-valued property keys. So every array index is a String-valued property key.
|
I still don't see where 9.4.2.1 contains a logic error. Array indices are a subset of integer indices, and integer indices are a subset of String-valued property keys. So every array index is a String-valued property key. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
annevk
Apr 20, 2017
Contributor
You're right, I read it the wrong way. Still, I think an abstract operation would be much clearer.
|
You're right, I read it the wrong way. Still, I think an abstract operation would be much clearer. |
annevk commentedApr 18, 2017
https://tc39.github.io/ecma262/#sec-array-exotic-objects seems to define array index somewhat informatively. Could there be a more formal definition there so it can be reused by IDL?
You probably also do not want to define it only for String properties, since as far as I can tell https://tc39.github.io/ecma262/#sec-array-exotic-objects-defineownproperty-p-desc can invoke it upon a Symbol, for which it would not be defined?
Something like an IsArrayIndex abstract operation would be great.