Re: Wanted: standard Array function to append an array's elements to another array

2011-11-01 Thread David Bruant
Hi, I have just noticed [1], read all messages on this thread and thought that the JavaScript stack size limit for Array.prototype.push.apply(firstArray, secondArray); was an implementation concern rather than anything else and it really sounds weird to me to add a method just because

Re: Wanted: standard Array function to append an array's elements to another array

2011-11-01 Thread David Bruant
Le 01/11/2011 22:17, David Bruant a écrit : (...) Regarding implementations of .push, if they can I meant *can't*, of course. do as good as a .pushAll could, then they are just buggy and should be fixed in my opinion. ___ es-discuss mailing list

Re: Wanted: standard Array function to append an array's elements to another array

2011-08-01 Thread Jeff Walden
On 07/31/2011 03:57 AM, Andrea Giammarchi wrote: I agree mine is more a workaround while we need a solution but it's not about Array here, it's about number of arguments limit per function so once we have pushAll in place, all other methods will still suffer the apply problem True. It seems

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-31 Thread Andrea Giammarchi
I agree mine is more a workaround while we need a solution but it's not about Array here, it's about number of arguments limit per function so once we have pushAll in place, all other methods will still suffer the apply problem and it's not about apply either, e.g. var tooMany =

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-29 Thread Andrea Giammarchi
to avoid apply limits is actually trivial: var fromCharCode = (function ($fromCharCode, MAX_LENGTH) { return function fromCharCode(code) { typeof code == number (code = [code]); for (var result = [], i = 0, length = code.length;

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-29 Thread Jeff Walden
On 07/29/2011 05:22 AM, Andrea Giammarchi wrote: to avoid apply limits is actually trivial More or less, yes. But it requires the developer to anticipate the concern in advance that the elements being appended might consume all available stack space. I don't think most developers think at

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-28 Thread Jeff Walden
On 07/27/2011 10:12 PM, Mark S. Miller wrote: We could debate the pros and cons of this sort of chaining convention in general. However, in this case I think the more important issue is API consistency. I was thinking this might actually be more consistent, to return this. Consider

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-27 Thread David Flanagan
On 7/25/11 12:54 PM, Jeff Walden wrote: Object.defineProperty(Array.prototype, pushAll, { enumerable: false, configurable: true, writable: true, value: function pushAll(other) { use strict; var t = ToObject(this); var length = ToUint32(t.length); var

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-27 Thread Mark S. Miller
On Wed, Jul 27, 2011 at 9:21 AM, David Flanagan dflana...@mozilla.comwrote: Could you return this instead of undefined so that we can chain calls? For example: a.pushAll(b).pushAll(c).sort() We could debate the pros and cons of this sort of chaining convention in general. However, in this

Wanted: standard Array function to append an array's elements to another array

2011-07-25 Thread Jeff Walden
If I have one array, and I want to append the contents of an arbitrary array to it, and I don't need the unmodified first array after appending the second array's elements to it, I have three options. First, I can use Array.prototype.concat to create a new array consisting of the first array,

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-25 Thread Jeff Walden
It's perhaps worth noting that this problem also occurs with String.fromCharCode. I suspect the need for a version of |String.fromCharCode.apply(null, codesArray)| that always works, even for super-big |codesArray|, is rather smaller than for the similar Array.prototype.push concern. Jeff