Filename (was Re: [BUG] FileDirectory>>exists)

Julian Fitzell julian at beta4.com
Thu May 22 00:25:49 UTC 2003


Tim Rowledge wrote:
>>>idea would be to have a new class called Filename that represent files 
>>>only. As a result, we would be able to move a lot of stuff from 
>>>FileDirectory to Filename.
> 
> I pretty much agree, except that Filename should represent file _names_
> only. An actual open file should be represented by some Stream object.
> 
> The problem we face is the pervasive (ab)use of strings to represent
> files and directories and too many other things in almost all other
> languages. People coming to Smalltalk from these pits of evil and
> iniquity write code that does terrible things with Strings and then make
> a FileStream named: '/foo/bar\wibble/../../.tribble' and wonder why it
> doesn't work across all platforms. Designing a decent Filename class is
> not a terrifically difficult thing to do (just steal inspiration from VW
> for example) but getting people to adopt it is a major educational
> project.

I posted something about this a few weeks ago.  I think we should look 
at having File class, rather than a Filename (unless we perhaps want 
both).  The File class would obviously know the name of the file it 
represented and would be able to provide you with a stream on that file. 
  It could also provide operations to rename the file, etc.  Haven't 
thought too much about the details or possible issues, but it seems to 
me like a good idea on the surface, anyway.

Julian




More information about the Squeak-dev mailing list