Jordan Harband (2015-01-20T20:13:11.000Z)
ljharb at gmail.com (2015-01-20T20:16:52.816Z)
Between the two issues I proposed, I definitely think that "something pretending to be a builtin" is far less hazardous then "altering builtins to appear to be something else". If removing the prefixing entirely is what it takes to make *all* (not just ES5) builtin @@toStringTag values non-configurable, I'd be happy with that. That said, new code interacting with old code is indeed the hazard, since the old code won't know anything about ES6. > But in these cases developers have plenty of opportunities to test the interaction. And they quite probably are introducing the "Array" return value specifically to go down a specific code path in the old code. (For example, if they have created an array-like proxy that behaves like an Array in all other ways.) The current spec forces them to instead override Object.prototype.toString itself if they want to go down that path. If it's a proxy to an actual array, wouldn't @@toStringTag be proxied too? If it's not a proxy to an actual array, why is the fact that it's a proxy relevant - it seems like your question is the same if you say "array-like object" also? Just to be sure I'm understanding. The real issue, as you've pointed out, is that there's no easy way to answer the question "does this value behave like an array" short of either ducktyping, or treating it like one, and seeing if it breaks. Let's fix that problem instead of allowing people to misuse @@toStringTag as an attempt to fake an answer to that question.
ljharb at gmail.com (2015-01-20T20:16:29.741Z)
Between the two issues I proposed, I definitely think that "something pretending to be a builtin" is far less hazardous then "altering builtins to appear to be something else". If removing the prefixing entirely is what it takes to make *all* (not just ES5) builtin @@toStringTag values non-configurable, I'd be happy with that. That said, new code interacting with old code is indeed the hazard, since the old code won't know anything about ES6. > But in these cases developers have plenty of opportunities to test the interaction. And they quite probably are introducing the "Array" return value specifically to go down a specific code path in the old code. (For example, if they have created an array-like proxy that behaves like an Array in all other ways.) The current spec forces them to instead override Object.prototype.toString itself if they want to go down that path. If it's a proxy to an actual array, wouldn't @@toStringTag be proxied too? If it's not a proxy to an actual array, why is the fact that it's a proxy relevant - it seems like your question is the same if you say "array-like object" also? Just to be sure I'm understanding. The real issue, as you've pointed out, is that there's no easy way to answer the question "does this value behave like an array" short of either ducktyping, or treating it like one, and seeing if it breaks. Let's fix that problem instead of allowing people to misuse @@toStringTag as an attempt to fake an answer to that question.
ljharb at gmail.com (2015-01-20T20:16:21.616Z)
Between the two issues I proposed, I definitely think that "something pretending to be a builtin" is far less hazardous then "altering builtins to appear to be something else". If removing the prefixing entirely is what it takes to make *all* (not just ES5) builtin @@toStringTag values non-configurable, I'd be happy with that. That said, new code interacting with old code is indeed the hazard, since the old code won't know anything about ES6. > But in these cases developers have plenty of opportunities to test the interaction. And they quite probably are introducing the "Array" return value specifically to go down a specific code path in the old code. (For example, if they have created an array-like proxy that behaves like an Array in all other ways.) The current spec forces them to instead override Object.prototype.toString itself if they want to go down that path. If it's a proxy to an actual array, wouldn't @@toStringTag be proxied too? If it's not a proxy to an actual array, why is the fact that it's a proxy relevant - it seems like your question is the same if you say "array-like object" also? Just to be sure I'm understanding. The real issue, as you've pointed out, is that there's no easy way to answer the question "does this value behave like an array" short of either ducktyping, or treating it like one, and seeing if it breaks. Let's fix that problem instead of allowing people to misuse @@toStringTag as an attempt to fake an answer to that question.