Agreeing on user-defined unique symbols?

Brendan Eich brendan at mozilla.com
Fri Aug 2 13:15:59 PDT 2013


I like this. Cc'ing Dave and Sam to get to top of their queues.

/be

Kevin Smith wrote:
> - Anarchy is not appropriate when the number of names which must be 
> *simultaneously distinguishable* passes some threshold.  The longer 
> the names, the higher that threshold will be.  In this case, the set 
> of names which must be simultaneously distinguishable is the set of 
> property names used within some loosely-defined runtime context.
>
> Because we only need to worry about the set of property names used 
> within a runtime context, and not the complete universe of property 
> names, we might be able get away with anarchy, so long as we choose 
> sufficiently long property names.  One possibility:
>
>     class C {
>         "sys/iterator"() { }
>         "foo/userDefined"() { }
>     }
>
> In the future, syntactic sugar could be added for declaring lexically 
> bound property name aliases.  One possibility:
>
>     alias { "sys/iterator" as iterator, "foo/userDefined" as 
> userDefined };
>     class C {
>         iterator() { }
>         userDefined() { }
>     }
>
> Note that this approach allows multiple modules to recognize the same 
> "strong" property name without requiring a dependency on a common 
> module.  In other words, modules can coordinate on strong property 
> names without needing to be connected.


More information about the es-discuss mailing list