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
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
beginners@lists.squeakfoundation.org