>> 1.  List (or Sequence or something else): same interface as Array (hence 
>> array-like). No holes, indices are non-negative integers, etc.
>> 2.  Map (possibly the SimpleMap that has already been specified).
> 
> One reason I introduced this the OMR strawman when I did is because we are 
> already committed to adding new "collection" objects (Map, WeakMap, Set, and 
> possibly others) to ES6 and that they currently have to use get/set 
> method-based APIs.  Early adoption of OMR would allow these new kinds of 
> collections to use [ ] for data element access.  I also suspect (but haven't 
> worked through the details) that use of OMR could also improve inthe Binary 
> Data/Typed Array abstractions. 

Different implementations would also allow one to optimize for either of the 
two use cases of arrays: Lisp-style linked lists versus Java-style fixed-size 
contiguous arrays with efficient random access.

Not sure how to express that decision in code, possibly via an aliases to a 
constructors (a.k.a poor man’s typedef).

     const ListArray = LinkedList;
     const VectorArray = FixedSizeContiguousArray;
     // problem: Array can’t be a RHS above, Array.of() might work

I would also want a method such as Array.isArrayLike(), but that might be 
jumping the gun and best delayed until there are contracts or something similar.

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to