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

Herby Vojčík herby at
Thu Feb 14 09:34:11 PST 2013

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.)

I know I already said that, but I repeat: `map` transforms elements, 
`filter` just selects a subset. Therefore I am 100% for `filter` doing 
the same kind of collection as the receiver. Bit not necessarily for `map`.

So I think, not, `filter` should not behave same as `map`.

> 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.

I think `filter` should behave the same as `slice`, `splice`, `reverse` 
and `concat`. They have clear rationale to use same kind of container.

> Nathan


More information about the es-discuss mailing list