Xtreams updates: positioning, slicing and stitching

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Xtreams updates: positioning, slicing and stitching

mkobetic
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

Reply | Threaded
Open this post in threaded view
|

Re: Xtreams updates: positioning, slicing and stitching

Francisco Ortiz Peñaloza
Hi Martin, thanks i'll try it later!

It would help if you could provide a Metacello configuration for it.

Cheers,
Francisco

On Sat, Jan 1, 2011 at 6:03 PM, <[hidden email]> wrote:
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


Reply | Threaded
Open this post in threaded view
|

Re: Xtreams updates: positioning, slicing and stitching

mkobetic
In reply to this post by mkobetic
"Francisco Ortiz Peñaloza"<[hidden email]> wrote:
> Hi Martin, thanks i'll try it later!
>
> It would help if you could provide a Metacello configuration for it.

Yes, something like that is clearly needed, but I'm still finding my way around the environment. However at the moment Xtreams don't have any prerequisites, so something like the gofer expression below should do it (you can skip the tests if you want).

        Gofer new
                squeaksource: 'Xtreams';
                package: 'Xtreams-VWCompatible';
                package: 'Xtreams-Core';
                package: 'Xtreams-Terminals';
                package: 'Xtreams-Transforms';
                package: 'Xtreams-Substreams';
                package: 'Xtreams-SqueakExternals';
                package: 'Xtreams-SqueakTextConverter';
                package: 'Xtreams-CoreTests';
                package: 'Xtreams-TerminalTests';
                package: 'Xtreams-TransformsTests';
                package: 'Xtreams-SubstreamsTests';
                load

But we'll likely want a metacello config eventually, especially when we bring in FFI for calling things like zlib and libcrypto.

Cheers,

Martin