On 6/17/15 1:54 PM, Jordan Harband wrote:
Could I not use `Object(Symbol.for('some global registry symbol'))` as a
`WeakMap` key? That would return a realm-specific object, of course.

Object(Symbol.for("x")) == Object(Symbol.for("x")) tests false. That's because http://www.ecma-international.org/ecma-262/6.0/#sec-object-value reaches step 3 which lands you in http://www.ecma-international.org/ecma-262/6.0/#sec-toobject which returns a new Symbol object every time.

So while you _could_ use Object(Symbol.for('some global registry symbol')) as a weakmap key it would not be terribly useful unless you hung on to that object somewhere.

-Boris
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to