Hi Damien,
I can understand it both ways.
I agree that sending contents after setting the position is a bit odd. It
is quite easy to get the results in other ways. It would make sense to get
entire contents if for example we are editing a stream.
On the other hand the current contents of the write stream itself do only
include what is before the current position, since everything else will be
written over when you add to the stream without changing the position.
Having position linked to contents allows for things like backspacing
without having to purge the write stream of data.
Both ways make sense, since this seems to be consistent with other
smalltalks you have to wonder if a change would cause problems in things
like ParagraphEditor. I would say that we should leave it and provide a new
method called #fullContents or something like that to get the desired
results. (and change the standard?). What do other Smalltalks do?
Ron Teitelbaum
> From: Damien Cassou
>
> Do you think that the following behavior is desired?
>
> stream := WriteStream with: 'something'.
> stream contents. => 'something'
> stream position: 2.
> stream contents. => 'so'
>
> We get the same result on Squeak and VisualWorks.
>
> Based on ANSI, #contents must return 'something' on both cases.
>
> --
> Damien Cassou
>