Claude Pache (2015-02-10T08:54:03.000Z)
> Le 10 févr. 2015 à 06:40, Gary Guo <nbdd0121 at hotmail.com> a écrit :
> 
> Sorry for not noticing the change. It seems the ES6 spec changes the behavior of *.prototype object. In ES5, *.prototype is itself a * object. However, because in ES5 Object.prototype.toString.call(String.prototype) will return [object String], my proposal does not break any legacy code, instead, if not implemented, legacy code could be broken.

Changing `String.prototype` from String to non-String is indeed a risk by itself. But the issue I was mentioning is independent of that, namely that an unknown object would be misidentified as String and would throw on methods that work only on Strings, e.g.: `if (getType(obj) == "String") { return obj.toUpperCase() }`, where `getType()` is based on `O.p.toString`.

—Claude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150210/e4cefe74/attachment.html>
d at domenic.me (2015-02-17T19:13:47.110Z)
Changing `String.prototype` from String to non-String is indeed a risk by itself. But the issue I was mentioning is independent of that, namely that an unknown object would be misidentified as String and would throw on methods that work only on Strings, e.g.: `if (getType(obj) == "String") { return obj.toUpperCase() }`, where `getType()` is based on `O.p.toString`.