Array subclassing, .map and iterables (Re: Jan 30 TC39 MeetingNotes)
Claus Reinke
claus.reinke at talk21.com
Fri Feb 15 01:46:58 PST 2013
>> I'd say that either we properly clean up the Array hierarchy, or we
>> leave it alone. A half-baked solution that only applies to typed
>> arrays, and divorces them from the Array hierarchy, seems less
>> attractive than just doing the naive thing, i.e., TypedArray< Array.
>
> Agree with that, and I'll go further: we should leave alone what's
> already shipped and in use for a long time.
>
> TypedArray < Array sounds good to me.
The question is how to clean up/refine the class hierarchy with
the existing language means. Consider a hypothetical
FixedLengthArray < Array
and a FixedLengthTypedArray that inherits from both branches.
More immediately relevant for this thread, I would like to see
Array < Container
with map, from, filter, and perhaps some others, moving from
Array to Container. Then Map and Set would be Containers,
supporting operations currently limited to Array (WeakMap
is probably too special to be a normal Container).
Claus
More information about the es-discuss
mailing list