tc39 / proposal-collection-normalization

MIT License
41 stars 8 forks source link

Sets do not have keys, they have values #8

Closed domenic closed 5 years ago

domenic commented 5 years ago

Related to #6: although set values are unique like map keys are, they are still generally referred to as values, not keys.

In the spec so far, this only manifests unobservably:

But I still think it's good to align with common understanding of how sets work.

bmeck commented 5 years ago

I think the counter example is that .has(_) works on keys for Maps and has similarity across Sets. Either way, ideally Set and Map should have some level to do this in a compatible way. The naming conventions of the spec are interesting here. Would given https://github.com/tc39/proposal-richer-keys/issues/6 it might make sense to provide both, merely because of this issue. I actually think we should move discussion back to https://github.com/tc39/proposal-richer-keys/issues/6 as it relates to multiple collection types.