By letting Array.prototype[@@toStringTag] = 'Array', String.prototype[@@toStringTag] = 'String', Function.prototype[@@toStringTag] = 'Function', Error.prototype[@@toStringTag] = 'Error', Boolean.prototype[@@toStringTag] = 'Boolean', Number.prototype[@@toStringTag] = 'Number', Date.prototype[@@toStringTag] = 'Date', RegExp.prototype[@@toStringTag] = 'RegExp, we are able to simplify Object.prototype.toString's algorithm and make constructor.prototype[@@toStringTag] more consistent.
What's more, it can also preserve compatibility for pre-ES6 codes, since most prototypes are now ordinary objects. In ES5: Object.prototype.toString.call(String.prototype) == '[object String]' In current ES6 spec: Object.prototype.toString.call(String.prototype) == '[object Object]' After my proposal: Object.prototype.toString.call(String.prototype) == '[object String]' Reported as https://bugs.ecmascript.org/show_bug.cgi?id=3857
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

