Re: [whatwg/webidl] Maplike/setlike iterators shouldn't use MapIteratorPrototype/etc (Issue #1142)

I don't think any option here is likely to actually affect users in any noticeable way, so I am personally fine with any outcome here.

I _do_ think some choices might affect engines. If WebIDL stuff re-uses `MapIteratorPrototype`, that means that engines have to either use the same underlying data structure for those things as for Maps, or have to make their implementation of `MapIteratorPrototype` dispatch for multiple different possible underlying data structures. So maybe that's a reason not to re-use it. But this is pure speculation on my part.

From a theoretical purity perspective, I think the previous WebIDL spec, where there was a `[[BackingMap]]` which held an actual ES Map which was never exposed to code but which was used to provide iterators, was clearly "acceptable" from the point of the ES spec (whatever that means). So it seems to me that an editorial change with no normative implications ought to be acceptable as well (i.e., https://github.com/whatwg/webidl/pull/1138), if that's what's most convenient for consumers of WebIDL.

---

That said, I do think that anything using `MapIteratorPrototype` should have observable behavior which is consistent with actual Map iterators, to avoid confusing people, which was trivial when there was a real `[[BackingMap]]` and now needs to be enforced by review of the actual iteration algorithm and invariants.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1142#issuecomment-1119108225
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1142/1119108225@github.com>

Received on Thursday, 5 May 2022 22:44:25 UTC