A reset question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

A reset question

Henrik Sperre Johansen
|writeStream|
writeStream := String new writeStream.
writeStream nextPut: $a.
writeStream reset.
writeStream isEmpty.

What would you expect?

Cheers,
Henry

Reply | Threaded
Open this post in threaded view
|

Re: A reset question

laurent laffont
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 <[hidden email]> wrote:
|writeStream|
writeStream := String new writeStream.
writeStream nextPut: $a.
writeStream reset.
writeStream isEmpty.

What would you expect?

Cheers,
Henry


Reply | Threaded
Open this post in threaded view
|

Re: A reset question

Alexandre Bergel
In reply to this post by Henrik Sperre Johansen
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
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






Reply | Threaded
Open this post in threaded view
|

Re: A reset question

Henrik Sperre Johansen

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