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
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
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
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 =
I may be late here, but what's wrong with
firstArray = firstArray.concat(secondArray); ?
If there are still problems I would say no magic method can solve them,
isn't it?
On Fri, Jul 29, 2011 at 1:59 AM, Jeff Walden jwalden...@mit.edu wrote:
On 07/27/2011 01:26 PM, John-David Dalton wrote:
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;
On 07/29/2011 05:01 AM, Andrea Giammarchi wrote:
I may be late here, but what's wrong with
firstArray = firstArray.concat(secondArray); ?
If there are still problems I would say no magic method can solve them, isn't
it?
That creates a new array rather than mutate the array originally
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
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
On 07/27/2011 01:26 PM, John-David Dalton wrote:
@Jeff In reply to
https://mail.mozilla.org/pipermail/es-discuss/2011-July/016124.html,
which engines have problems with `firstArray.push.apply(firstArray,
secondArray)` ?
Shouldn't a bug report be filed for the specific JS engine or the spec
be
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
@Jeff In reply to
https://mail.mozilla.org/pipermail/es-discuss/2011-July/016124.html,
which engines have problems with `firstArray.push.apply(firstArray,
secondArray)` ?
Shouldn't a bug report be filed for the specific JS engine or the spec
be clarified on the subject (String.fromCharCode too)
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
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,
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
15 matches
Mail list logo