Skip to content
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

Inconsistent lists of slots associated with Integer-Indexed exotic objects / TypedArray instances #1801

Open
bathos opened this issue Dec 4, 2019 · 1 comment

Comments

@bathos
Copy link
Contributor

bathos commented Dec 4, 2019

The definitions of Integer-Indexed exotic objects and TypedArrays and certain operations associated with each include lists of slots, but these lists are inconsistent.

9.4.5 Integer-Indexed Exotic Objects

Integer-Indexed exotic objects have the same internal slots as ordinary objects and additionally [[ViewedArrayBuffer]], [[ArrayLength]], [[ByteOffset]], [[ContentType]], and [[TypedArrayName]] internal slots.

9.4.5.7 IntegerIndexedObjectCreate(prototype, internalSlotsList)

  1. Assert: internalSlotsList contains the names [[ViewedArrayBuffer]], [[ArrayLength]], [[ByteOffset]], [[ContentType]], and [[TypedArrayName]].

22.2.4.2.1 Runtime Semantics: AllocateTypedArray

  1. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], [[TypedArrayName]], [[ContentType]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »).

22.2.7 Properties of TypedArray Instances

Each TypedArray instance has the following internal slots: [[TypedArrayName]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]], and [[ArrayLength]].

There are six associated slots in total. Only the AllocateTypedArray operation lists all six. It’s also the only one where the list is ‘for real’ rather than occurring in an assertion or outside of algorithmic text.

As far as I can tell, all TypedArray instances are Integer-Indexed exotic objects and vice versa, and they are all created with AllocateTypedArray, so all such objects would have all six slots. Is there significance to the omission of some slots from some of these lists, or should they be uniform?

Recap:

Slot IIEO Def IIOC Op ATA Op TA Instance Def
[[ArrayLength]] yes yes yes yes
[[ByteLength]] - - yes yes
[[ByteOffset]] yes yes yes yes
[[ContentType]] yes yes yes -
[[TypedArrayName]] yes yes yes yes
[[ViewedArrayBuffer]] yes yes yes yes
@ljharb ljharb added the editor call to be discussed in the next editor call label Nov 22, 2020
@ljharb ljharb added needs editorial changes and removed editor call to be discussed in the next editor call labels Dec 2, 2020
@bathos
Copy link
Contributor Author

bathos commented Jan 21, 2022

Since writing this, there have been changes (#1460) which alter the table originally provided above and fixed some of the discrepancies. The “IIOC op” column is fixed and the “ATA op” column is moot because IntegerIndexedObjectCreate no longer takes a slots argument and instead has a fixed list inlined (which does include [[ByteLength]]).

The other two cases remain: “Integer-Indexed Exotic Objects” still omits [[ByteLength]] and “Properties of TypedArray Instances” still omits [[ContentType]].

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

No branches or pull requests

3 participants