Implicit coercion of Symbols

Brendan Eich brendan at mozilla.org
Sun Jan 4 02:34:11 PST 2015


Alex Kocharin wrote:
>>
>>      My point is: concatenating Symbols with other strings have
>>     legitimate
>>      uses.
>>
>> Name one.
>>
> I did name one in another message. Logging.

That's a use-case for some way (could be concatenation, but as noted the 
downside risk is huge; could be a new Reflect method) to convert symbol 
to string. Explicit is better than implicit. Saying "Logging" does not 
say "allow implicit symbol to string conversion".

I agree that String(sym) working where ''+sym throws is funky (my word 
in this thread). We could make both throw, with a Reflect.symbolToString 
or whatever it might be called. ES6 is about out of time, this may not 
fly, but if it is possible it has to be done quickly.

/be


More information about the es-discuss mailing list