I updated the Xtreams port (http://www.squeaksource.com/Xtreams) over the
holidays to catch up with the state on VW side. The primary changes are
updates/fixes of the positioning API and a cleanup/extension of the slicing
API. The slicers are replaced by much simpler #slicing setup and the inverse,
#stitching, was added (the updated documentation can be found in the usual
place: http://code.google.com/p/xtreams/wiki/Substreams). More details on the
changes below.
Enjoy,
Martin
Positioning updates:
* ++/--/+=/-=/position: now return the argument instead of self
* they all also skip as far as they can raising Incomplete with the count of
the actual amount skipped
* this means that the positioning wrapper will advance as far forward as it
needs to satisfy the request, in case of -= it means it will advance all the
way to the end of the underlying stream.
* similarly asking a positioning wrapper for length or available will make it
advance to the end
* in the other direction, positioning wrapper can't skip past the beginning of
its buffer, so if the buffer window moves forward, so does the absolute
position; position 0 is always the beginning of the buffer, whereever it is at
any given moment
* also extended ++ and -- to call the other if the argument is negative (it
helps with implementation of the others)
All read/write/positioning calls except put:/get/read: now consistently return
element counts so that one can use a computation as an argument and then obtain
the actual number in response. This simplifies common patterns like:
actual := [ stream ++ (x max: y) ] on: Incomplete do: [ :ex | ex count
].
instead of:
actual := x max: y.
[ stream ++ actual ] on: Incomplete do: [ :ex | actual := ex count ].
Slicing/Stitching updates:
Replacing all the -er: slicer creation methods with the new #slicing and adding
complementary #stitching.
* #slicing is sent to a substream "prototype" and clones it when next slice is
needed, e.g.
(stream limiting: 3) slicing
* #stitching is sent to a read stream of streams and makes it look like one
continuous stream
[ stream limiting: stream get ] reading stitching
* stitching replaces the experimental proto and concatentation streams
* ReadStream>>, is now implemented with stitching too