<div dir="ltr"><div>Hello,</div><div><br></div><div>What is the expected behavior for a stream that is at position 1 when you send #peekBack? Intuitively I'd expect to get the first element of the underlying collection as a response. But instead I am getting nil.</div><div>  <br></div><div>Here is an example that is failing:</div><div>```</div><div>elem := #(1 2 3 4).<br>stream := ReadStream on: elem.<br>first := stream next.<br>first = 1.<br>back := stream peekBack.<br>back = first.</div><div>```<br></div><div>The last message is currently responding false. In Pharo this returns true, so there are differences.</div><div><br></div><div>The currently implementation of PositionableStream >> #peekBack is:</div><div>```</div><div>peekBack<br>       "Return the element at the previous position, without changing position.  Use indirect messages in case self is a StandardFileStream."<br><br>   | element |<br>   self position = 0 ifTrue: [self errorCantGoBack].<br>     self position = 1 ifTrue: [self position: 0.  ^ nil].<br>        self skip: -2.<br>        element := self next.<br> self skip: 1.<br> ^ element</div><div>```<br></div><div><br></div><div>I can see the nil being returned there explicitly, so that's "where it's happening." Should this be the case though?</div><div><br></div><div>Thanks<br></div><div><br></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Eric</div></div></div></div></div>