Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Normative: bugfix: do not count ~empty~ in set sizes #105

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Conversation

bakkot
Copy link
Collaborator

@bakkot bakkot commented Dec 20, 2023

Various algorithms normatively depend on "the number of elements in _O_.[[SetData]]". But the [[SetData]] list is completely fictional: it contains ~empty~ tombstones for deleted elements. We need to skip those when actually using the size in an observable way, but not when using it as a bound for a loop which is indexing [[SetData]].

Hopefully no implementations actually implemented the wrong thing, though it's hard to see how they could have.

<emu-clause id="sec-setdatasize" type="abstract operation">
<h1>
SetDataSize (
_setData_: a List of either ~empty~ or ECMAScript language values,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a List" is sufficient here, but this is also fine.

@bakkot bakkot merged commit a3a4741 into main Feb 6, 2024
1 check passed
@bakkot bakkot deleted the fix-size branch February 6, 2024 22:55
ljharb added a commit to es-shims/Set.prototype.intersection that referenced this pull request Feb 6, 2024
ljharb added a commit to es-shims/Set.prototype.difference that referenced this pull request Feb 6, 2024
ljharb added a commit to es-shims/Set.prototype.isSubsetOf that referenced this pull request Feb 6, 2024
ljharb added a commit to es-shims/Set.prototype.isDisjointFrom that referenced this pull request Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants