Comments on Sept Meeting Notes

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Sep 26 16:28:10 PDT 2013


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



More information about the es-discuss mailing list