[BUG] FileDirectory>>exists

Lukas Renggli renggli at hotmail.com
Thu May 22 07:04:43 UTC 2003


Anthony Adachi  wrote:
> In the AppleScript Inheritance Object Model files and
> containers (i.e.- directories/disks/folders) are
> different kinds of objects. File and containers have
> commands (messages) and properties (access methods to
> instance variables) to which they both respond
> (polymorphic). However, they have their own
> responsibilities which they specialize in. They are
> subclasses of item which one can use if one needs to
> deal with both files and containers. 
>
> [...]
>
> Is that something like what you had in mind at first?

I'm quite sure, that this is more or less the thing I like to have in 
Squeak, although I could not find the documentation on the Apple page. 

But this is not the end: other classes could be added to the hierarchy 
to handle compressed files seamless. That means I want to access and 
work with compressed files exactly the same way as I do with the plain 
file-system. I don't even want to know, if I do not care.

> The concept of working with an item within the file
> system (i.e.- moving, copying, renaming, ect.) is a
> separate idea than working on the contents of a file
> (as one would do with a Stream).

I agree, streams are something completely different to files/filenames. 
I just want to be able to ask my file for a write/read/append/whatever-
stream so I am able to modify it easily.

In my opinion a new class with the described responsibilities should be 
called Filename, because I also want to use it to create new files and 
to deal with non-existent and deleted ones. Of course we would need 
messages like FileDirectory>>exists and Filename>>exists (as seen in my 
tests) to check the actual presence of those entities. 

I don't think, that anyone expects Filename>>renameTo: just to change 
the internal filename, but to rename the actual file in the file-system. 
To make this paradigm even stronger, I would even suggest to make it 
impossible to change the filename after creating it. That means we have 
to create a new instance (or use some factory messages), if we need a 
derived filename. I don't want people to deal with strings anymore, 
everything should be done in a platform independent manner within that 
class.

Cheers
Lukas

-- 
Lukas Renggli
http://renggli.freezope.org



More information about the Squeak-dev mailing list