[Ecls-list] Re: (Lisp Support Call #25967) The mysteriously "hidden" section 19.2.3 of the HyperSpec
davef at xanalys.com
davef at xanalys.com
Tue Jan 6 06:55:02 UTC 2004
*DEFAULT-PATHNAME-DEFAULTS* is not quite the same as the current working
directory because it can be set (or even bound with LET), but that won't change
the real current directory.
LispWorks developers found that *DEFAULT-PATHNAME-DEFAULTS* is a major hassle if
it is bound to anything other than #p"", in particular because it affects the
type of pathname returned by PARSE-NAMESTRING and MAKE-PATHNAME. This in turn
can cause chaos if pathnames are used within the implementation of some function
that just happens to be called while *DEFAULT-PATHNAME-DEFAULTS* is bound.
We'll fix the misplaced links you found in the Hyperspec.
Xanalys Technical Support
Subject: (Lisp Support Call #25967) The mysteriously "hidden" section 19.2.3
of the HyperSpec
The following message is a courtesy copy of an article
that has been posted to comp.lang.lisp as well.
The CLHS has a section 19.2.3 entitled "Merging Pathnames" which,
judging from its number, should be linked from 19.2 but
isn't. Instead, it is linked from 188.8.131.52.
19.2.3 contains the sentence
"Except as explicitly specified otherwise, for functions that
manipulate or inquire about files in the file system, the pathname
argument to such a function is merged with *DEFAULT-PATHNAME-DEFAULTS*
before accessing the file system (as if by MERGE-PATHNAMES)."
On my machine, at least two CL implementations (CMUCL 18e and ECL
0.9c) get this wrong:
* (setf *default-pathname-defaults* #p"/tmp/bar/")
* (probe-file "fump")
On a related note, I was wondering why several Lisps have a concept of
a "current working directory" which seems to exist in parallel (and
maybe even in an incompatible way) to *DEFAULT-PATHNAME-DEFAULTS*.
1. In LispWorks, CMUCL, and CLISP (and probably others) the initial
value of *DEFAULT-PATHNAME-DEFAULTS* is always #p"" no matter where
you started your Lisp image from although the HyperSpec gives the
hint that the value should be "typically in the working directory
that was current when Common Lisp was started up."
2. CMUCL (EXTENSIONS:DEFAULT-DIRECTORY), LispWorks (HCL:CHANGE-DIRECTORY
and HCL:GET-WORKING-DIRECTORY), and AllegroCL (EXCL:CURRENT-DIRECTORY
and EXCL:CHDIR) (and probably others) provide means to query and
manipulate a pathname which is detached from
Is this because these functions existed before the ANSI standard was
finalized and backwards compatibility was deemed more important than a
consistent interface? I think this is a pity because (unless I'm
missing something) *DEFAULT-PATHNAME-DEFAULTS* would be a fine, Lisp-y
way to map the Unix/Windows concept of "the current directory" to CL.
PS: Copies of this article have been sent to the CMUCL and ECL mailing
list as well as to Xanalys support (as they seem to be the CLHS
maintainers). My apologies if this has been fixed already.
 However, although LispWorks seems to adher to 19.2.3, if the value
of *DEFAULT-PATHNAME-DEFAULTS* is a relative directory, the result
of merging a filespec with *DEFAULT-PATHNAME-DEFAULTS* will be
merged again with LispWorks' "working directory."
More information about the ecl-devel