String(symbol)

Brendan Eich brendan at mozilla.org
Tue Aug 26 10:01:04 PDT 2014


Jeff Walden wrote:
> It's not the most correct way to do it.  |a + ""| performs ToPrimitive(a, hint = None), whereas ToString(a) performed ToPrimitive(a, hint = String).  The former consults valueOf, then toString, the latter the reverse.

Argh, I had forgotten about the no-hint case there. It seems wrong 
still, but I forget the details from ES1 era.

Domenic's question of why you want an explicit ToString in the language 
remains. If there's a strong reason for it, Reflect.toString might be 
the answer.

/be


More information about the es-discuss mailing list