tc39 / proposal-set-methods

Proposal for new Set methods in JS
https://tc39.github.io/proposal-set-methods/
Other
659 stars 15 forks source link

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

Closed bakkot closed 7 months ago

bakkot commented 9 months ago

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.