tc39 / proposal-global

ECMAScript Proposal, specs, and reference implementation for `global`
http://tc39.github.io/proposal-global/
MIT License
349 stars 18 forks source link

Cross realm global handling #18

Closed medikoo closed 7 years ago

medikoo commented 7 years ago

Wouldn't it be wise to also specify some way for cross-realm global properties handling.

e.g. it's already provided internally for Symbol.for and Symbol.keyFor.

In that case I think we can't expose any object, but rather three map-like methods get, set, has, that will work strictly with strings or symbols as key values.

ljharb commented 7 years ago

I'm not sure what you mean. The whole point is that we don't want a global cross-realm communications channel - the Symbol registry works because it's primitives, so you can't transmit any information that way.

Either way, this would be a totally unrelated and separate proposal, so this repo isn't the place to discuss it.

medikoo commented 7 years ago

Technically in browser environments you have a global cross-realm communication, e.g. you can deal with objects created in other realm (another frame)

And in case of Symbol, it's a GlobalSymbolRegistry map of primitives (so an object) that it's shared and accessed across realms. I thought that this use case can happen in user-land for some other functionalities

ljharb commented 7 years ago

It's a map but can only contain primitive keys and values, and can't communicate whether a key is present or not.