A strawman architecture for new collections.
A strawman architecture for new collections. It contains some example collection classes and methods with the intent to expose some key issues. It would be good to compare this to odether implementations of the same functionality, to get an idea of the strengths and weaknesses of different collection architectures.
For a test file, see tests/run/CollectionTests.scala.
Strawman6 is like strawman5, and adds lazy lists (i.e. lazie streams), arrays and some utilitity methods (take, tail, mkString, toArray). Also, systematically uses builders for all strict collections.
Types covered in this strawman:
IterableOnce, Iterable, Seq, LinearSeq, View, IndexedView
2. Collection creator base types:
FromIterable, IterableFactory, Buildable, Builder
3. Types that bundle operations:
IterableOps, IterableMonoTransforms, IterablePolyTransforms, IterableLike SeqMonoTransforms, SeqLike
4. Concrete collection types:
List, LazyList, ListBuffer, ArrayBuffer, ArrayBufferView, StringView, ArrayView
5. Decorators for existing types
StringOps, ArrayOps
6. Related non collection types:
Iterator, StringBuilder
Operations covered in this strawman:
For iterables:
iterator, fromIterable, fromIterableWithSameElemType, knownLength, className
For sequences:
apply, length
For buildables:
newBuilder
For builders:
+=, result
2. Utility methods, might be overridden for performance:
Operations returning not necessarily a collection:
foreach, foldLeft, foldRight, indexWhere, isEmpty, head, size, mkString
Operations returning a collection of a fixed type constructor:
view, to, toArray, copyToArray
Type-preserving generic transforms:
filter, partition, take, drop, tail, reverse
Generic transforms returning collections of different element types:
map, flatMap, ++, zip