[Pkg] The Trunk: Collections-mt.1009.mcz

commits at source.squeak.org commits at source.squeak.org
Wed May 4 08:32:50 UTC 2022


Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.1009.mcz

==================== Summary ====================

Name: Collections-mt.1009
Author: mt
Time: 4 May 2022, 10:32:30.135961 am
UUID: ef5d326a-a140-794f-b3f4-62097eb357fe
Ancestors: Collections-eem.1008, Collections-EG.908

Merges Collections-EG.908.

Changing  behavior of #peekBack to (correctly) return first element of underlying collection when stream position is 1.

The behavior is now on par with Cuis. Also see:
http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-August/210935.html

=============== Diff against Collections-eem.1008 ===============

Item was added:
+ ----- Method: PositionableStream>>oldBack (in category 'accessing') -----
+ oldBack
+ 	"Go back one element and return it.  Use indirect messages in case I am a StandardFileStream"
+ 	"The method is a misconception about what a stream is. A stream contains a pointer *between* elements with past and future elements. This method considers that the pointer is *on* an element. Please consider unit tests which verifies #back and #oldBack behavior. (Damien Cassou - 1 August 2007)"
+ 	self position = 0 ifTrue: [self errorCantGoBack].
+ 	self position = 1 ifTrue: [self position: 0.  ^ nil].
+ 	self skip: -2.
+ 	^ self next
+ !

Item was added:
+ ----- Method: PositionableStream>>oldPeekBack (in category 'accessing') -----
+ oldPeekBack
+ 	"Return the element at the previous position, without changing position.  Use indirect messages in case self is a StandardFileStream."
+ 
+ 	| element |
+ 	element := self oldBack.
+ 	self skip: 1.
+ 	^ element!

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 Packages mailing list