On Jul 12, 2011, at 2:54 AM, Andreas Rossberg wrote: > On 9 July 2011 17:48, Brendan Eich <[email protected]> wrote: >> >> Adding names as a distinct reference and typeof type, extending >> WeakMap to have as its key type (object | name), adds complexity >> compared to subsuming name under object. > > It seems to me that you are merely shifting the additional complexity > from one place to another: either weak maps must be able to handle > (object + name) for keys (instead of just object), or objects must > handle (string + object * isName) as property names (instead of just > string + name).
Quite right. This was a part of ECMA-357, E4X, which we have suppported in SpiderMonkey starting in late 2004. It was a part of ES4 as well. On the other hand, there's no free lunch for private names having a new typeof type: "name". They cannot be strings, so the VM's property lookup and identifier-handling code paths all need a wider type. True, they *could* be UUIDs in strings that have a tag bit set to prevent forgery, but that's not a likely implementation. So given that id types and lookup code paths have to change anyway, this seems more of a wash than you suggest. Not a total wash, but not a clear with for new typeof-type "name". /be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

