2007/8/1, Klaus D. Witzel <[EMAIL PROTECTED]>:
> 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
_______________________________________________
V3dot10 mailing list
[email protected]
http://lists.squeakfoundation.org/mailman/listinfo/v3dot10

Reply via email to