Single argument Array.prototype.splice
On Oct 27, 2010, at 10:37 AM, Allen Wirfs-Brock wrote:
ES3 and 5 specify Array.prototype.splice such that [1,2,3].splice(1) means the same thing as [1,2,3].splice(1,0)
Mozilla documents (developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice) an extended form of splice: array.splice(index, [howMany, [element1][, ..., elementN]]); // SpiderMonkey extension
where [1,2,3].splice(1) essentially means [1,2,3].splice(1, [1,2,3].length)
Most other browsers also seem to support this extensions. Was it an oversight that ES5 was not updated to include support for this extended behavior?
An oversight from the ES3 era, carried forward into ES5 without review that I can recall.
Is there consensus that this is defacto standard behavior that is needed for interoperability among browsers and that it should be incorporated into Harmony?
I suspect this is a de-facto standard we should codify in Harmony. Thanks for bringing it up.
ES3 and 5 specify Array.prototype.splice such that [1,2,3].splice(1) means the same thing as [1,2,3].splice(1,0)
Mozilla documents (developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice) an extended form of splice: array.splice(index, [howMany, [element1][, ..., elementN]]); // SpiderMonkey extension
where [1,2,3].splice(1) essentially means [1,2,3].splice(1, [1,2,3].length)
Most other browsers also seem to support this extensions. Was it an oversight that ES5 was not updated to include support for this extended behavior?
Is there consensus that this is defacto standard behavior that is needed for interoperability among browsers and that it should be incorporated into Harmony?