[Newbies] Re: writing to a stream after close

nicolas cellier ncellier at ifrance.com
Fri Oct 3 21:47:53 UTC 2008


Mark Volkmann a écrit :
> Why is it that when I do a "print it" on all the code below, it outputs 
> 'foobar'?
> Shouldn't the writing of 'bar' fail because I've closed the stream?
> 
> ws := WriteStream on: ''.
> ws nextPutAll: 'foo'.
> ws close.
> ws nextPutAll: 'bar'.
> ws contents
> 
> ---
> Mark Volkmann

Close does nothing. Browse implementation.
It is only here so that you can replace a file stream or socket or pipe 
etc, with an internal stream transparently...
... Well, almost transparently: you should not expect the latter to 
simulate any OS error like read only, lost connection, broken pipe, or 
closed file.

Nicolas



More information about the Beginners mailing list