tc39 / proposal-symbols-as-weakmap-keys

Permit Symbols as keys in WeakMaps, entries in WeakSets and WeakRefs, and registered in FinalizationRegistries
http://tc39.es/proposal-symbols-as-weakmap-keys
MIT License
90 stars 7 forks source link

Only allow 'unique' and 'well-known' symbols #23

Closed acutmore closed 2 years ago

acutmore commented 2 years ago

Made a start on what the spec text changes could be if registered and well-known symbols were not allowed in WeakMap, WeakSet, WeakRef and FinalizationRegistry

Closes #21

acutmore commented 2 years ago

It is my understanding that for forward web compatibility we would prefer to actually name the exposed predicate something like isUnforgeable.

Thanks @rricard - good point that this was still being discussed. I've created an issue https://github.com/tc39/proposal-symbols-as-weakmap-keys/issues/24

acutmore commented 2 years ago

Based on the most recently conversations in the Record & Tuple monthly call - I have updated the PR:

bathos commented 2 years ago

also return true for well-known symbols by only returning false for symbols that are registered.

@acutmore I’d thought about this (way too much) and came to the same conclusion, but wasn’t confident about my ability to articulate the case coherently. It’s really cool to see that this is where you’ve landed!