[Pharo-project] A reset question
|writeStream| writeStream := String new writeStream. writeStream nextPut: $a. writeStream reset. writeStream isEmpty. What would you expect? Cheers, Henry
false. PositionableStream>>#reset "Set the receiver's position to the beginning of the sequence of objects." position := 0 Laurent On Thu, Jan 20, 2011 at 2:40 PM, Henrik Johansen < henrik.s.johansen@veloxit.no> wrote:
|writeStream| writeStream := String new writeStream. writeStream nextPut: $a. writeStream reset. writeStream isEmpty.
What would you expect?
Cheers, Henry
I think you have a good point. #reset is ambiguous here. Maybe we should have two methods: #resetIndex and #resetContent Cheers, Alexandre On 20 Jan 2011, at 10:40, Henrik Johansen wrote:
|writeStream| writeStream := String new writeStream. writeStream nextPut: $a. writeStream reset. writeStream isEmpty.
What would you expect?
Cheers, Henry
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Jan 20, 2011, at 2:54 40PM, Alexandre Bergel wrote:
I think you have a good point. #reset is ambiguous here.
Maybe we should have two methods: #resetIndex and #resetContent
Cheers, Alexandre
Hehe, I have a sense others must have thought the same, I missed them first time around: PositionableStream>>resetContents "Set the position and limits to 0." position := 0. readLimit := 0 WriteStream>>resetToStart readLimit := position := 0. Cheers, Henry
participants (3)
-
Alexandre Bergel -
Henrik Johansen -
laurent laffont