I did some research trying to figure out what precisely WebIDL would need to move to actual Map/Set subclasses for maplike and setlike, and this appears to be it for read/write collections. Specifically:
Maplikes and setlikes in WebIDL always need to coerce their keys and (for maplikes) values.
Ordered sets and ordered maps in Infra carry the same guarantees that JS sets have, including insertion order, and the operations those have that JS sets don't (namely prepend, replace, subset, intersection, and union, though the last 3 have a proposal to rectify that) aren't used for setlikes and maplikes.
What Infra basically mandates is the same kind of workaround that this proposal tries to avoid, just using composition instead of inheritance.
Also, having a hook for read-only maps and sets to modify their data could also be potentially useful, allowing readonly maplike/readonly setlike to also extend from Map and Set respectively.
I did some research trying to figure out what precisely WebIDL would need to move to actual
Map
/Set
subclasses formaplike
andsetlike
, and this appears to be it for read/write collections. Specifically:What Infra basically mandates is the same kind of workaround that this proposal tries to avoid, just using composition instead of inheritance.