[Haskell-cafe] FilePath handling

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Sep 15 10:50:11 EDT 2004

Henning Thielemann <nutscrape-zetem at henning-thielemann.de> writes:

> I even plead for an abstract data type FilePath which supports
> operations like 'enter a directory', 'go one level higher' and so
> on.

Beware of Common Lisp history:


"As we discussed in chapter TK, Common Lisp provides an abstraction,
the pathname, that is supposed to insulate us from the details of how
different OS's and file systems name files. However the gods of
abstraction give and they take away. While, with a bit of care,
pathnames can be used to write code that will be portable between
different OS's it can, ironically, be quite tricky to write pathname
code that that will be portable between different Common Lisp
implementations on the *same* OS.

The root of the problem is that the pathname abstraction was designed
to represent file names on a wide variety of file systems. The set of
file systems still in general use at the time Common Lisp was being
standardized was much more variegated than the set of file systems
that are commonly used now. Unfortunately, by making pathnames
abstract enough to account for a wide variety of file systems, Common
Lisp's designers left implementors with a fair number of choices to be
made when mapping the pathname abstraction onto a particular file
system. Consequently different implementors, each implementing the
pathname abstraction for the same file system, by making different
choices at a few key junctions, could end up with conforming
implementations that nonetheless provide different behavior for
several of the main pathname-related functions."

   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

More information about the Haskell-Cafe mailing list