next up previous contents
Next: External Resources Up: Streams and Iterators Previous: Collecting Protocols   Contents

Iterator Streams

Many types (typically collections) define their own Stream type which goes over its elements in series, even if the collection is not ordered, and only visits each element once. This type's prototype is accessed via the slot ReadStream within each collection (located on its traits object). So ``Set ReadStream'' refers to the prototype suitable for iterating over Sets.

In order to create a new iterator for a specific collection, the iterator message is provided, which clones the prototype for that collection's type and targets it to the receiver of the message. The protocol summary:

iterator
will return a ReadStream or preferably a ReadWriteStream if one is available for the type.
reader
and writer get streams with only ReadStream and WriteStream capabilities for the type, when available.
The stream capabilities supported for each basic collection type are usually limited by the behavior that the type supports. The capabilities per basic type are as follows; types not mentioned inherit or specialize the capabilities of their ancestors:

Type Capabilities
Collection


next up previous contents
Next: External Resources Up: Streams and Iterators Previous: Collecting Protocols   Contents
Brian Rice 2004-08-24