[ANSI-Smalltalk] #contents on WriteStream
Paolo Bonzini
bonzini at gnu.org
Thu Oct 16 21:18:06 BST 2008
Bruce Badger wrote:
> On 16/10/2008, Paolo Bonzini <bonzini at gnu.org> wrote:
>> (WriteStream on: String new) nextPutAll: 'abc'; skip: -1;
>> contents
>>
>> should "return a collection that contains the receiver's past and future
>> sequence values, in order", i.e. 'abc'. To me it makes more sense that
>> it returns 'ab'.
>
> In the face of it, 'ab' makes sense in this case, but what would you
> return for a write stream on a file or a socket ... an exception or
> something else?
That's why in the other message I propose to move the definition of
#contents (instead of being in <collectionStream> and <FileStream>) to
<gettableStream> (including read-only files, ReadStream,
ReadWriteStream) and separately on <WriteStream>.
In practical implementation parlance, the answer would be
"#doesNotUnderstand: or #shouldNotImplement".
Paolo
More information about the ANSI-Smalltalk
mailing list