Agreeing on user-defined unique symbols?

Kevin Smith zenparsing at
Fri Aug 2 12:45:56 PDT 2013

> I still see big usability problems with UUIDs, even if used to name
> non-enumerable properties. Tools help but the core language provides no
> sugar, salt, or paprika. Just a very sour/bitter hex-string...
I agree.

There are only three different approaches to collision avoidance that I'm
aware of:

1) "Noise":  Use enough randomness such that the chance of collision is
effectively zero for practical purposes. (ex. uuids)

2) "The Registry":  A central authority determines who can use each name.
(ex. DNS)

3) "Anarchy":  Rely on participants to organically manage the namespace.
(ex. the global object)

- Noise is not appropriate when the name is going to be handled by humans.
 At the very least, our property names will be handled by humans during the
debugging process.

- DNS-based names are universally despised.

- 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.

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list