[ANN] Nile: a trait-based stream library
Lukas Renggli
renggli at gmail.com
Wed May 2 15:51:56 UTC 2007
> > - Right now the only available stream classes work on in-memory
> > collections. I would like to be able to use them on Files and Sockets
> > as well.
>
> Implementing streams on Files and Sockets is a bit difficult for me
> because I haven't any knowledge about them.
I know that these are difficult. That's also why those streams are
currently duplicating all functionality. However with your traits
that should be simple to connect the few primitive methods ;-)
> > - The current Squeak Stream implementation lacks the possibility (and
> > it is difficult to do so in a clean way) to wrap streams with other
> > streams. What I would like to be able to do wrappers that encode,
> > decode (URL, HTML, BASE64, Cryptography, ...), filter, select,
> > collect, parse streams in different ways. See [1] for some examples.
> > The wrapping could also be used to provide synchronization on shared
> > streams.
>
> You would like the framework to let you chain the streams, aren't you?
> So that you have a stream which interact with another stream.
Yes, pipes of streams.
s := GzipStream on: (Base64Stream on: (WriteStream on: String new))
s nextPutAll: 'foobar'
s contents would return a string of 'foobar' zipped and converted to BASE64.
> > - #upTo: is cool. For most purposes this is however too basic. I need
> > many different efficient and reliable variations of that. It should be
> > possible to read up to ...
> > - the first sub-collection of elements
> > - the first place a block predicate is satisfied
> > - the first place a regular expression matches
> > - the first place a of a set of the above conditions matches
>
> It would not make sense to implement all of this. But what about a
> #upToSatisfying: which evaluates the block for each element and stops
> when it returns true?
No that is not enough, because the context within the stream is
missing. What we probably need is another object that you can
configure for the search and that does something sophisticated to do
an efficient search on the underlying collection.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch
More information about the Squeak-dev
mailing list
|