So in order to save one call to chain() you'd use a non-standard object over a native array? What would underscore methods return, then? Perhaps it could do type detection and return what it gets, but then you have the issue that the executing code needs to be aware of that too - which means a type check at the caller before invoking the underscore expression. Needless to say, I think that's a lot of added complexity for not a lot of benefit.
Heck, if you really wanted to adapt something from Array.js you could do the naive (but I think correct) thing which is to add a flag to all underscore methods indicating whether or not the method should return an "Underscored" object or the basic data type. This could even be an initialization parameter for Underscore.
What does this buy you? I can only think of two things. First is they get a more object-oriented feel to their code.
var foo = _.filter([1,2,3], func, true);
// later on...
foo.filter(func2);
I guess the first question I have is, what does line 3 do? Are we mutating foo? Or returning something new? In which case we've managed to save precisely one character
_.filter(foo, func2);
Even worse, we're saving the wrong character. One undersung quality of having one global object per major library is that, in the code, you get a
big contextual clue about what's going on from the way it's invoked. Contrast these two lines:
foo.filter(func2);
_.filter(foo, func2);
Try to imagine that you're encountering these lines deep in the bowels of the code. Which one is easier to understand?
The second thing you get is a (what I think is) esoteric benefit of being able to "ship" underscore functionality with the data to far away places. This is only an issue in full require()-controlled programs where there might be some communication between closures, and one side wants to use underscore in that context, but not add a dependency. Personally, I think being able to do that is just asking for trouble, as, again, your calling code maintainers are going to be totally befuddled by running into objects doing things that no other objects in that side are doing - or worse, doing something that looks familiar, but isn't.