[squeak-dev] Re: Can we change the meaning of peekBack?
nicolas.cellier.aka.nice at gmail.com
Mon Jul 28 15:05:08 UTC 2014
2014-07-28 17:02 GMT+02:00 Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com>:
> Hi, I need to retrieve the last object put on a Stream (well
> SmartRefStream does).
> This is very much like #ensureEndsWith:
> There is back, but back leave the stream positionned before the last
> ((ReadWriteStream on: String new) nextPutAll: 'abc'; back) -> $c
> ((ReadWriteStream on: String new) nextPutAll: 'abc'; back; position) -> 2.
> There is peekBack, but peekBack answers the last but one...
> ((ReadWriteStream on: String new) nextPutAll: 'abc'; peekBack) -> $b.
> ((ReadWriteStream on: String new) nextPutAll: 'abc'; peekBack; position)
> -> 3.
> Note that neither back nor peekBack is understood by a WriteStream.
> It requires a ReadWriteStream.
> Since peekBack is the sole sender of oldBack in trunk, I wonder who is
> using it?
> I ask because I'd like to change the meaning of peekBack to that of back
> instead of oldBack.
> Unless you have a better selector to propose?
More exactly, I'd like to implement PositionnableStream>>peekBackFor:
anObject to return a Boolean like peekFor: and it would be a good thing
that peekBack answers the same Object.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev