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

Realms use case #15

Open leobalter opened 3 years ago

leobalter commented 3 years ago

As seen in the recent discussions for Realms, this proposal has now become a very useful feature that could be used to share identities through multiple realms. Using Weakmaps with symbol keys would be a first step to config membranes.

This proposed feature goes straight to our usage without increased complexity. Transferring a symbol identity through realms seems like a separate concern. Although, using Records and Tuples for this separate concern still feels overkill as we would need to specify what it means to transfer their structure to set identity references. There is no depreciation for the use cases of R&T, but we'd need to enable Symbols as WeakMap keys as the base for the next proposal-step.

leobalter commented 3 years ago

For clarification, If this feature becomes reality, we could already use it through other forms to reach different Realms, including iframes. The dependency is only from a shared identity proposal to this one, but this one does not depend on anything else. I hope it can find progress towards the stage process soon!