[ANN] TextFiles published on SqueakMap

Doug Way dway at riskmetrics.com
Wed Aug 6 17:26:04 UTC 2003


Andreas Raab wrote:

>>I second SmartTextStream over TextFile.
>>
>>Names are important.
>>    
>>
>
>I agree, so let me briefly give you the reasoning why I chose TextFile. My
>assumption was that  most people will want to use the encoding/crlf
>conversion when they deal with external files. So I would guess that the
>most likely question to which the answer is "TextFile" would look like: What should I use to read/write TEXT from/to a FILE?
>

How about the name TextFileStream?

It is still a type of stream, and implements #peek, #position, #next, 
and all the usual stream protocol, so I think it ought to have "Stream" 
in the name.

With a name like TextFile, I tend to think of an object representing a 
file (which it sort of is, I admit) that I could send messages like 
#rename (to rename the file) or #copyTo: (to copy to a new file) or 
#size (to get the file size).  The kind of stuff that should be moved 
out of FileDirectory into a File or Filename class.  Oh wait, I see you 
have implemented #size. :-)  But I still think I prefer TextFileStream 
over TextFile.

I guess there could be some slight confusion with TextStream, but the 
names kind of make sense.  TextStream deals with Text objects, 
TextFileStream deals with text files (with a small "t" :-) ).  The 
confusion will probably be there either way.

I agree that the "Smart" prefix is not really necessary.  A class that 
deals explicitly with text files implies that line end conventions will 
be handled somehow.

Anyway, this changeset looks like a nice approach overall!

- Doug


>
>That text file is able to deal with internal streams (which I think is most
>of the argument for the more generic "stream" term) is a bit of a side
>effect here which I didn't really intend when I started (it just turned out
>that testing is a lot easier on internal streams ;-) and I don't think it'll
>be the primary use and so I think that the term file may be easier to
>associate than stream.
>
>BTW, I _would_ be happy with TextStream as a more general name, but I
>heavily oppose that "Smart" prefix. First of all, "Smart" doesn't tell you
>anything about where the smartness is and it often leaves people with the
>impression of some bit of software trying to be "overly smart". Given that
>TextFile does only a bit of encoding and crlf translation (which boils down
>to straight text replacement) there is absolutely nothing "smart" about it.
>It's just what a modern text stream _has_ to do these days unless you really
>want to ignore 80% of the world.
>
>All in all I think that unless we merge TextStream with TextFile I'm happy
>with the name as it is. Merging is something that I actually thought about
>quite a bit (but I haven't done anything yet) as it would be Really Nice
>(tm) if we were able to do something like this:
>	myFile := TextFile newFileNamed: 'workspace.html'.
>	myFile encoding: #html.
>	myFile nextPutAll: workspace contents. "formatted text"
>etc.
>
>Cheers,
>  - Andreas
>
>  
>




More information about the Squeak-dev mailing list