Extending FileList with CrLf

Lex Spoon lex at cc.gatech.edu
Sat Jul 26 04:22:09 UTC 2003


Okay, and here's an attempt to sum up a response.  :)

First, if CLFS is the default, clients can still get a no-translation
behavior if they want it.  CLFS calls this #binary mode, which is
great because that's what most people call a file where you have to
be very specific about the *exact* bytes that are appearing.

Second, the translation CLFS does may sound smart, subtle, and
specific, but please note that it's a very common translation
to desire.  There are three conventions that almost all files follow,
and autodection is no problem.  Even when some other convention
is used, or a mix is used, CLFS does something reasonable and will
never crash.  Quite a lot of code is going to want exactly what CLFS
does.

So the argument goes, why not make this the default for #text mode?

Two bits of philosophy.

First, libraries should not only be flexible, but they should also
help the common usages.  At the extreme, a library could simply
send #value to whatever block you pass in, and thus be ultimately
flexible -- and also ultimately useless!  Whatever design we end 
up with, should allow normal text files to get CLFS's translation.

Second, note that files already respond to #text in Squeak.  That
message is supposed to mean, "put yourself in text mode".  That
means, "return text, when I ask you for data".  The concept of
text mode is clearly in the class; shouldn't we implement the
concept well?  Is there really such a thing as a "text file", where the
specific line encoding matters?


Anyway, I wouldn't die or anything if I had to use a wrapper to get
CLFS's functionality.  I just really hate having some people use CLFS as
the default and others not, because we end up with subtly incompatible
code from each other.  The CLFS people are merrily putting files in
#text mode, and the non-CLFS people are merrily writing code that uses
FileStream versus CrLfFileStream explicitly.  I like the CLFS aproach,
because normally the files are in #text mode anyway!  However, I don't
like how people from the two camps are writing incompatible code.  I'd
rather do it the yucky way than to have this micro-fork.

Lex



More information about the Squeak-dev mailing list