Implicit coercion of Symbols

Tab Atkins Jr. jackalmage at
Sat Jan 3 17:43:50 PST 2015

On Jan 3, 2015 3:38 PM, "Rick Waldron" <waldron.rick at> wrote:
> E. W/r to A and C, most code will need some kind of guard, just to avoid
the exception, ie. either try/catch or `if (typeof s !== "symbol") ...`

This isn't a cost introduced by the throwing behavior, it's one that'll
have to happen in code regardless of what we decide, or else the code will
be incorrect. You can never construct modified keys from a Symbol by
concatenation, even if it stringifies.

So your code either needs to be sure it won't be passed a Symbol, or else
it needs to branch its behavior.

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

More information about the es-discuss mailing list