Faré <[EMAIL PROTECTED]> writes:

> The IRC discussion spawned by my previous bug report raised the point
> of read-write invariance of #p syntax, and the fact that once again,
> cmucl, sbcl and openmcl (and gcl, too) might be wrong by not
> distinguishing the following:
>
> (MAKE-PATHNAME :DIRECTORY NIL)
> => #P""
>
> (MAKE-PATHNAME :DIRECTORY '(:RELATIVE))
> => #P""
>
> clisp, allegro and lispworks agree that it is a good idea to print the
> latter as follows
> => #P"./"
> [...]
> The whole issue boggles my mind. Now it can boggle yours, too.
>
> Hopefully no more language lawyering for today.

Pathnames aren't really my bag, but I thought about this a little, and
I don't think there's a problem.  According to the CLHS, the directory
argument to MAKE-PATHNAME must be "a valid pathname directory", where
that is defined by the glossary:

   valid pathname directory n. a string, a list of strings, nil, :wild,
   :unspecific, or some other object defined by the implementation to be
   a valid directory component.

The list (:relative) apparently doesn't qualify, unless it's "defined
by the implementation...".

Unfortunately, 19.2.2.5 is slightly contradictory, but says pretty
much the same thing:

   * The directory can be a list of strings and symbols. There are
   * implementation-dependent limits on the list's length and
   * contents.

and

   * Any component can be taken from the corresponding component of
   * another pathname.

But that would seem to allow passing (:relative), provided you got it
from some other pathname.  However, 19.2.2.4.3 says this (among other
things) about the directory component of pathnames:

   A list whose car is the symbol :relative represents a directory
   path starting from a default directory. The list (:relative) has
   the same meaning as nil and hence is not used. The list (:relative
   "foo" "bar") represents the directory named "bar" in the directory
   named "foo" in the default directory.

Note the second sentence in particular.  So an implementation should
never give you a pathname with (:relative) as the directory component,
and it seems perfectly legal for implementations to say that
(make-pathname :directory '(:relative)) is either illegal, or means
the same as (make-pathname :directory nil).

Does that make sense?

-- 
Todd Sabin                                          <[EMAIL PROTECTED]>


Reply via email to