Allen Wirfs-Brock (2013-10-01T16:54:01.000Z)
domenic at domenicdenicola.com (2013-10-13T02:46:24.656Z)
On Oct 1, 2013, at 3:10 AM, Andreas Rossberg wrote: > OK, thanks for the summary, that makes sense. The one worry I have, > though, is that not tainting S.p.toString itself will miss cases where > code tries to convert some value x to a property name by explicitly > calling x.toString(). Currently, that works for everything but null > and undefined, so I assume that this pattern is used quite a bit. Do you think thing it really is? Any value (other than null and undefined) automatically converts to a string when used as a property selector. so there really isn't any reason (other than lack of knowledge) for someone to explicitly toString values before using them as a property key. On the other hand, there are plenty of reasons in other use cases where someone might explicitly toString because they actually want a string description of a value. Either choice we make here is probably going to trip up some code. I think what I've specified is the best set of trade-offs, but I willing to be convinced otherwise. I suspect hard evidence supporting either alternative is hard to find > There always is the generic Object.prototype.toString that can be made > to handle symbols. That is what V8 currently does (producing a string > just like you describe above). But this forces such code to be rewritten to special case Symbol values (assuming that they don't want, for example, string values and Arrays to display as [object. String] and [object Array]). Also, the spec. current says that O.P.toString for a Symbol returns [object Symbol] rather than Symbol(<descriptive string provided when created>). This is to keep it consistent with other types of values and code that expects O.p.toString to always produce the [object <name>] pattern.