symbols in template literals

Brendan Eich brendan at
Thu Sep 11 14:59:32 PDT 2014

Claude Pache wrote:
> Recently, `String(symbol)` has been modified in order to not throw, on the ground that it is an explicit conversion, and a safer one than `.toString()`. [1]

And to cite the hazard, because obj[name +''] where name is a non-symbol 
must continue to work as it has, but if extant code like this suddenly 
is passed a symbol for name, we want a throw rather than an unintended 
property alias.

> What about symbols in untagged templates?
>      function foo(num, sym) {
>          if (__debugMode)
>              window.alert( `Got arguments: ${num} and ${sym}`)
>          // ...
>      }

Doesn't seem to have the property alias hazard. Seems explicit enough of 
a gesture to me to allow. My two cents, but only two (in a hurry, may be 
missing something).


More information about the es-discuss mailing list