[ANSI-Smalltalk] #peekFor:
Paolo Bonzini
bonzini at gnu.org
Wed Oct 1 07:06:16 BST 2008
> When I wrote my stream classes, I took the standard text literally,
> and my #peekFor: never advanced the stream position. Whoops!
> I propose the following replacement for the definition:
>
> Definition: <gettableStream>
> If the receiver has no future sequence values,
> returns false. Otherwise, determines the result of
> sending #= to the first object in the receiver's
> future sequence values with anObject as the argument.
> If that is false, return false with no change to the
> receiver's state. If #= answers true, the first
> object is removed from the receiver's future sequence
> values and appended to the end of the receiver's past
> sequence values, then true is returned.
Indeed.
Paolo
More information about the ANSI-Smalltalk
mailing list