[squeak-dev] The Inbox: Collections-EG.908.mcz

David T. Lewis lewis at mail.msen.com
Sat Aug 8 02:14:11 UTC 2020


Actually, I think that the new ReadStreamTest>>testPeekBack is not in
agreement with the existing RWBinaryOrTextSteamTest>>testPeekBack.

The peekBack method was not in Squeak 3.6, but it appears in Squeak 3.8.
It is unused in the image, but it presumably is intended to support parsing
things from a stream.

If I understand correctly, peek means "show me the next element that
has not yet been read from the stream", and peekBack means "show me the
element before the one that was most recently read from the stream".
So I expect that peekBack would mean to skip back 2 from the current
position, not skip back 1.

Dave

On Fri, Aug 07, 2020 at 09:32:56PM -0400, David T. Lewis wrote:
> The new tests and fix for PositionableStream look good, but there is a
> failure now in RWBinaryOrTextStreamTest>>testPeekBack.
> 
> Dave
> 
> On Sat, Aug 08, 2020 at 12:17:32AM +0000, commits at source.squeak.org wrote:
> > A new version of Collections was added to project The Inbox:
> > http://source.squeak.org/inbox/Collections-EG.908.mcz
> > 
> > ==================== Summary ====================
> > 
> > Name: Collections-EG.908
> > Author: EG
> > Time: 7 August 2020, 8:17:30.343164 pm
> > UUID: d02855a8-a339-4f1d-bede-89a50f07892e
> > Ancestors: Collections-eem.907
> > 
> > Changing  behavior of #peekBack to (correctly) return first element of underlying collection when stream position is 1.
> > 
> > =============== Diff against Collections-eem.907 ===============
> > 
> > Item was changed:
> >   ----- Method: PositionableStream>>peekBack (in category 'accessing') -----
> >   peekBack
> >   	"Return the element at the previous position, without changing position.  Use indirect messages in case self is a StandardFileStream."
> > - 
> >   	| element |
> >   	self position = 0 ifTrue: [self errorCantGoBack].
> > + 	element := self back.
> > - 	self position = 1 ifTrue: [self position: 0.  ^ nil].
> > - 	self skip: -2.
> > - 	element := self next.
> >   	self skip: 1.
> >   	^ element!
> > 
> > 
> 


More information about the Squeak-dev mailing list