[ANN] TextFiles published on SqueakMap

Andreas Raab andreas.raab at gmx.de
Wed Aug 6 18:34:19 UTC 2003


Hi Doug,

> How about the name TextFileStream?

Thought about that too, but rejected it as both, "too long" ;-) and not
really helpful either (meaning: more intention revealing). Abstractly, I
don't see much of a difference between a file and a stream. But if people
think that TextFileStream is a better name, I'll happily change it (though
generally I like short names ;)

> 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).

I agree, and actually I'm in favour of supporting most of the common
operations on file streams. I really hate wrappers if I have to unwrap all
the time to do something useful ;-) You can see this already in the creation
methods - I could have equally well relied on FileStream's creation methods
along the lines of:

	TextFile on: (FileStream readOnlyFileNamed: 'input.txt').

but I find it really awkward to use. BTW, I don't event think there are many
(if any) useful methods of FileStream that TextFile needs to expose - while
the classes (both FileStream and StandardFileStream) are relatively large
the signal-to-noise ratio is pretty bad here. There's lots of stuff in there
just not much useful. The four or five methods which are required by
TextFile could equally well be implemented by some sort of IOHandle instead.

> 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 would really like to get rid of the (pretty arbitrary) distinction - to
me, Text (with a capital "T" ;) and text (with a small "t" - aka: String)
are totally interchangeable except that Text carries some additional
formatting with it. This _should_ be handled by TextFile accordingly,
depending on whatever "encoding" you choose.

[OT, but if you look at TextFile you'll see that the encoders can be chained
arbitrarily so it could even make sense to have a "formatter" for the text
attributation around which does the right translation for it. Haven't
thought about this too much, yet.]

Cheers,
  - Andreas



More information about the Squeak-dev mailing list