[V3dot10] Re: 0006583: PositionableStream>>back behavior is totally wrong

Damien Cassou damien.cassou at gmail.com
Wed Aug 1 15:32:39 UTC 2007


2007/8/1, Klaus D. Witzel <klaus.witzel at cobss.com>:
> Hi Damien,
>
> an actual user of #back is #asSignedInteger, from which I derived the
> following invariant:
>
>   aStream position == (aStream next; back; position)
>
> So #back can't be that wrong, no?

The previous behavior correctly changes the position. The problem is
with the returned value. With the previous behavior, when you send
back, you return the element that is not the element just before the
position.

stream := 'abc' readStream.
stream next: 2.
stream peek     ==> $c
stream oldBack    ==> $a    "this is incorrect. If we are between b
and c, #back must return b and not a"

stream back    ==> $b  "this is the result of the new implementation I proposed"


Is it clearer? Does it answer the question?

-- 
Damien Cassou


More information about the V3dot10 mailing list