Roles of FileStream (was: Re: New SqueakMap)

Josh Gargus schwa at fastmail.us
Wed Apr 12 22:20:55 UTC 2006


I agree with Andreas.

It seems to me that character-oriented streams (and any other streams  
that deal with structured data) should be layered on top of byte- 
oriented streams, as is done by SmartRefStream (through its  
superclass, DataStream).  A SmartRefStream doesn't care whether it's  
ultimately reading from / writing to a buffer in memory, from a file,  
or a network socket connection; that's the responsibility of its  
'byteStream'.

Josh


On Apr 12, 2006, at 5:03 PM, Andreas Raab wrote:

> Yoshiki Ohshima wrote:
>>> That  FileStream oldFileNamed: 'xyz.gif'  assumes that xyz.gif is  
>>> a text file of UFT-8 format looks to me like the principle of the  
>>> biggest surprise ;)
>>   Opening a .gif file as a text file with *any* encoding (including
>> non-conversion latin1) is logically wrong anyway...  So this example
>> may not tell us anything^^;
>
> It's actually funny for me to follow this discussion because it's  
> at the heart of why I think a separation of concerns is necessary.  
> The way I look at the above statements is that there is an  
> implicitly different assumption about what role "FileStream" has.  
> Martin makes the (not unreasonable) assumption that FileStream is a  
> byte-oriented stream, whereas Yoshiki makes the (equally  
> reasonable) assumption that FileStream is a character-oriented stream.
>
> Who is right? If characters are bytes, both. If characters are not  
> bytes (I think) neither. We're living in a state of confusion these  
> days because historically FileStream has been used for both  
> purposes and we're now learning that when characters are no longer  
> bytes we need to be a little clearer about the roles.
>
> Cheers,
>   - Andreas
>




More information about the Squeak-dev mailing list