shortcuts for defining block-local private names, plays nicely with @foo syntax

Axel Rauschmayer axel at rauschma.de
Wed Jan 25 00:12:02 PST 2012


>> 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
axel at rauschma.de

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120125/7fa33b49/attachment-0001.html>


More information about the es-discuss mailing list