Yes, I do need that. If you look at the implementation, it makes no attempt to set it prior, and I designed it to work generically [just like how `Array.prototype.push` does now][1] (see step 7). I'm aware that if you assume it's an array, the length will update itself, but it won't on array-likes.
[1]: https://tc39.github.io/ecma262/#sec-array.prototype.push ----- Isiah Meadows m...@isiahmeadows.com www.isiahmeadows.com On Fri, May 25, 2018 at 2:46 AM, T.J. Crowder <tj.crow...@farsightsoftware.com> wrote: > On Thu, May 24, 2018 at 7:02 PM, Isiah Meadows <isiahmead...@gmail.com> wrote: >>> With large arrays you can also run into a platform's stack size limit >>> with a large number of arguments. [snip] >>> >>> * Chrome v66: Between 120k and 130k entries >>> * Firefox v60: 500k - 510k >>> * Edge v41: 650k - 660k >>> * IE11: 250k - 260k >>> * IE8ยน: 5.25M (!) - 5.26M >> >> Wait, what? Of all things old IE screws up, this isn't one of them? > > I know, right? > >> Was the proposal `for (const i of y) x.push(y)`, like a mutable >> `concat`? I interpreted it as basically `x.push(y); return x` from the >> start, hence why I didn't see the point. > > Sorry, that's my bad. The original from Jordi Bunster was indeed just > `x.push(y); return x`: > >> Has anyone ever suggested Array.prototype.append as an >> Array.prototype.push which returns the array itself? It would be >> reduce-friendly, same as Set.prototype.add and Map.prototype.set. >> >> Someone has to have, right? ๐ > > Somehow in my head it became a mutating verson of `concat`, possibly > because I've often wanted a mutating version of `concat`, but I don't > recall really wanting a version of `push` that returns the array. > > `pushAll` looks good to me. (Re the desugared code: You don't need > that `this.length = index` at the end, though. :-) ) > > -- T.J. Crowder _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss