On Sep 26, 2013, at 4:13 PM, Yehuda Katz wrote:
> I don't understand why any registry is needed. Imagine a module
> "ember/symbols" implemented like this, assuming some sharedSpace that modules
> have access to cross-realms.
>
> ```
> var guid = "<generated literal>", symbol;
> if (sharedSpace[guid]) {
> symbol = sharedSpace[guid];
> } else {
> symbol = sharedSpace[guid] = new Symbol("friendly name");
> }
>
> export meta = symbol;
> ```
>
> And then in any realm:
>
> ```
> import { id } from "ember/symbols";
>
> // use `id` symbol
> ```
>
> So you still coordinate over Strings, but you don't need a VM-level registry,
> just a user-land one.
So the sharedSpace is a registry and it must be available to all realms that
want to cooperate. How those that happen other than via help from the VM or
the module load API (essentially part of the VM). Beyond that you are just
using an external guid to give you names that won't unintentionally collide in
the registry.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss