10 years ago
7 years ago


(Reporter: Waldo, Assigned: Waldo)



Bug Flags:
wanted1.9.2 +

Firefox Tracking Flags

(Not tracked)


(Whiteboard: fixed-in-tracemonkey [doc-waiting-landing])


(1 attachment)



10 years ago
Posted patch PatchSplinter Review
Recent array method discussion reminded me of this addition in ES5.  Trivial patch, in-browser users want it, out-of-browser users want it, about as no-risk a feature as they get -- nice driveby pickup for 3.6.  We should skim the spec for other ten-minute features...

Test fodder:

assertEq(Array.isArray.length, 1);
var empty = [];
var fastSmall = [1];
var slow = [];
slow.slow = 0;
var slowSmall = [];
slowSmall[999999] = 0;
slowSmall.length = 0;
var all = [empty, fastSmall, slow, slowSmall];
all.forEach(function(a) { assertEq(Array.isArray(a), true); });
assertEq(Array.isArray(), false);
assertEq(Array.isArray({}), false);
assertEq(Array.isArray(null), false);
assertEq(Array.isArray(undefined), false);
assertEq(Array.isArray(17), false);
assertEq(Array.isArray("Array"), false);
assertEq(Array.isArray(Math.PI), false);
assertEq(Array.isArray(true), false);
assertEq(Array.isArray(false), false);
Attachment #394528 - Flags: review?(jorendorff)
Flags: wanted1.9.2?
Attachment #394528 - Flags: review?(jorendorff) → review+

Comment 2

10 years ago
Whiteboard: fixed-in-tracemonkey


10 years ago
Flags: wanted1.9.2? → wanted1.9.2+
Any more like this missing from the es5 buglist?

Why not a traceable native?


Comment 4

10 years ago
I don't know if anything else is missing -- I've been too busy diving into Object.defineProperties and all those object meta-hooks at the moment to really look lately (and those are much orders of magnitude less trivial than this).  I probably should remedy that, maybe I'll do a spec skim over the weekend at some point.

As for why not a traceable native,

1) It's a driveby patch, didn't want to spend any more time on it than necessary.
2) We can do better than a traceable native; this really cries out for a bug 497173-based solution.
3) I think we get better ROI if I spend time on something like Object.defineProperties than if I spend time wringing out a couple dozen instructions' execution time for one method that nobody uses (yet).

I'm working on a web-tech post on this at the moment, although to be honest I'm less up on the reasons why someone would want to know if a value is an array than I'd like to be.  I'm probably going to lean a little on this URL for rationales and use cases for doing so, maybe ask a few people around Mozilla as well.  No rush, especially since this wants to be on branch before anything would actually be published.
Keywords: dev-doc-needed
Just askin', no sweat. Indeed bug 497173 approach could do a lot better than a traceable native!

You might ask jresig, bgalbraith, and dalmaer about isArray use cases.


Comment 6

10 years ago
Draft post:

(Mother Superior) jumping the gun a bit as this hasn't made 192 yet, but that'll happen eventually enough to make it worth posting this now...

Comment 7

10 years ago
Last Resolved: 10 years ago
Resolution: --- → FIXED
Would appreciate it if someone would let me know when this officially lands on 1.9.2.
Whiteboard: fixed-in-tracemonkey → fixed-in-tracemonkey [doc-waiting-landing]
Is this going to land on 1.9.2?


9 years ago
Duplicate of this bug: 537548
I wonder why searching for "Array.isArray" in bugzilla (before I created bug 537548) returned 0 results. Sigh.
You need to log in before you can comment on or make changes to this bug.