[squeak-dev] PositionableStream >> peekBack
jakob.reschke at student.hpi.de
Wed Jun 21 13:00:28 UTC 2017
I just stumbled upon the behavior of #peekBack. I expected that it
would give me a "preview" of what I would get when I send #back, but
without changing the position of the Stream (like #peek does for
#next). Or in other words, I expected to get the last read (or
As it turned out it answers the next-to-last element instead. There
even is a test case in RWBinaryOrTextStreamTest for this behavior.
But does it make sense? I have my doubts mainly because of the
inconsistency with the return value of #back.
There is also #peekLast, which does what I expected, but it is only
defined for File- and WriteStream and the comment says it is intended
to get the last put element, not a last read/extracted/next-ed
More information about the Squeak-dev