Alternative directory/file classes?

Howard Stearns hstearns at wisc.edu
Mon Mar 12 19:39:11 UTC 2007


Back when I believed in files (!), I thought the ANSI Common Lisp spec on
pathnames was as powerful as it needed to be, and no more.

It is highly portable and is the result of a lot of demanding use. Although it
predated (and influenced) OSI pathnames, URIs, and SCCS/RCS, it turned out to be 
powerful enough to represent each of these. Being future-proof is good.

http://www.lispworks.com/documentation/HyperSpec/Body/19_.htm
http://www.lispworks.com/documentation/HyperSpec/Body/20_.htm

The concepts are sufficiently powerful and well-chosen that the operations can 
all be defined in surprisingly little code. The key concepts are:

   + Separate Physical Pathname objects and Logical Pathname objects.

   + String designators for either of these, that can generally be used where the
above is expected.

   + Accessors for components of any of the above, including Host, Device,
Directory (an ordered collection), Name, Type, and Version.

   + Clear semantics for merging by components and matching with wildcards.

   + Canonical forms and Truenames.

   + Local Case and Common Case, with information-preserving transformations 
between the two (which is what allows merging/matching and canonical forms to 
actually be useful).

The spec deliberately left some things (e.g., version numbers) up to the
implementation. The conforming implementation-specific extensions that I wrote
(and felt necessary) are spec'd at
http://webpages.charter.net/stearns/howard/eclipse/eclipse/path.htm

The specs are all written as though all operations are functions, although many
implementations (including mine) were done as generic function methods.



Andreas Raab wrote:
> Hi -
> 
> Recently I got (once again ;-) horribly disgusted by the mess in the current
> file/directory classes in Squeak and started looking for alternatives. ...
> seemed a nice and simple interface to do all the practical things that you
> need when dealing with files/directories. ... How does it hold up in
> practice? ...Are there any other directory/file interfaces I should be
> looking at in my quest for a bit more cleanliness in these areas?
> 
> Cheers, - Andreas
> 

-- 
Howard Stearns
University of Wisconsin - Madison
Division of Information Technology
mailto:hstearns at wisc.edu
jabber:hstearns at wiscchat.wisc.edu
voice:+1-608-262-3724



More information about the Squeak-dev mailing list