[squeak-dev] Re: Can we change the meaning of peekBack?
Eliot Miranda
eliot.miranda at gmail.com
Mon Jul 28 19:46:28 UTC 2014
Hi Nicolas,
Why can't you use peekLast? Seems to me ensureEndsWith: should be implemented in terms of peekLast.
Aloha,
Eliot (phone)
On Jul 28, 2014, at 5:05 AM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
>
>
>
> 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 object.
>>
>> ((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...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140728/7f561cc1/attachment.htm
More information about the Squeak-dev
mailing list
|