Array subclassing, .map and iterables (Re: Jan 30 TC39 Meeting Notes)

Allen Wirfs-Brock allen at
Sat Feb 16 15:17:14 PST 2013

On Feb 14, 2013, at 8:47 AM, Nathan Wall wrote:

> Hey Allen, thanks for clarifying.
> What will happen to other Array methods which currently return Arrays? `filter` is the primary one that comes to mind. Will `uint32array.filter((v) => v != 0)` return a Uint32Array? (I think it should behave the same way `map` does.)

filter, splice, splice, reverse, etc. all copy elements that from an existing array or array subclass so the result can/should be the same class is the source array.  Map is different because it can produce new element values of an arbitrary kind that may not fit into the same kind of array as the source array

> Additionally, what will happen with the return values of `slice`, `splice`, and `reverse`?.. not to mention `concat`, which I know is a much more complex beast.

WRT to concat, see last three slides of 
> Nathan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list