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

Web platform integration #95

Open domenic opened 1 year ago

domenic commented 1 year ago

Should all setlikes get these methods? If so, we need to update Web IDL.

It's not clear that they should... but we should think through the known cases.

bakkot commented 1 year ago

Off the cuff thoughts:

The isSubsetOf and isSupersetOf methods seem like you might want them on all of these, though mostly to interact with JS Sets, and you can always do js.isSubsetOf(web) instead of web.isSupersetOf(js).


Honestly these seem sufficiently obscure that I expect the new Set methods, were they added, would see approximately zero use. What use cases there are can mostly (but not entirely) be met by using a built-in Set and passing the setlike as an argument (which we did ultimately decide should be supported - you can't .call these on non-builtin Sets, but you can pass non-builtin setlikes as arguments).

So personally I wouldn't bother adding them, at least not in advance of a request from developers.