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

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

Merged
bakkot merged 1 commit intomainfrom
fix-size
Feb 6, 2024
Merged

Normative: bugfix: do not count ~empty~ in set sizes#105
bakkot merged 1 commit intomainfrom
fix-size

Conversation

@bakkot
Copy link
Copy Markdown
Member

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

Comment thread spec/index.html
<emu-clause id="sec-setdatasize" type="abstract operation">
<h1>
SetDataSize (
_setData_: a List of either ~empty~ or ECMAScript language values,
Copy link
Copy Markdown
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
@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