[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue: Pathname-subdirectory-list
- To: cl-cleanup@sail.stanford.edu
- Subject: Issue: Pathname-subdirectory-list
- From: Masinter.pa@Xerox.COM
- Date: 15 Jul 87 13:24 PDT
- Cc: Ghenis.pasa@Xerox.COM
This arrived in my mailbox before the X3J13 meeting. While I suspect
there may be some alternative proposals, and perhaps some other
important related issues, this seems like a good way to introduce the
topic.
!
ISSUE: (PATHNAME-SUBDIRECTORY-LIST)
REFERENCES: CLtL pages 409 - 418
CATEGORY: ADDITION
EDIT HISTORY: Version 1 by Ghenis.pasa@Xerox.com, 06/18/87
PROBLEM DESCRIPTION:
It is impossible to write PORTABLE code that can produce a pathname
based on directory plus SUBDIRECTORY information. If the directory used
is not a root, then the string provided must contain OS-specific
separators. This defeats the purpose of having an abstraction like
pathname. Specifying a subdirectory RELATIVE to the current default is
possible but also inconvenient and non-portable.
This problem is even worse for programs running on machines on a network
that can retrieve files from multiple hosts, each using a different OS
and thus a different subdirectory delimiter.
PROPOSAL (PATHNAME-SUBDIRECTORY-LIST:ALLOW):
Add a :SUBDIRECTORIES field to pathnames, to store a list of strings.
The string form of a pathname can be obtained by using the appropriate
OS-specific separator and end-delimiters.
Require global variables called LISP:*HOST-OS-ALIST* and
LISP:*DEFAULT-OS* to provide the information needed to assemble
namestrings correctly
TEST CASE (desired behavior):
>(defparameter LISP:*HOST-OS-ALIST*
'(("vmsvax" . "vms") ("unixvax" . "unix"))
>(defparameter LISP:*DEFAULT-OS* "msdos")
>(defvar vmspath
(make-pathname :host "vmsvax"
:directory "smith"
:sudirectories '("lisp")
:name "test"
:type "lsp"))
>(defvar localpath
(make-pathname :directory "smith"
:sudirectories '("lisp")
:name "test"
:type "lsp"))
>(namestring vmspath)
"{vmsvax}[smith.lisp]test.lsp"
>(namestring localpath)
"c:\smith\lisp\test.lsp"
RATIONALE:
Pathnames are an abstraction meant to deal with the common notions in
file systems. Subdirectories exist in most operating systems. Common
Lisp must provide a standard way of dealing with subdirectories for
pathnames to be truly useful.
CURRENT PRACTICE:
CLtL acknowledges this problem and declares it to be a system dependent
issue.
ADOPTION COST:
This should be a simple addition to implement.
BENEFITS:
Adding a :SUBDIRECTORIES field to pathnames would make the abstraction
completely system-independent. Relative pathnames could be trivially
specified by pathnames lacking a :DIRECTORY field.
CONVERSION COST: This is an upwards-compatible addition.
AESTHETICS:
Adding a :SUBDIRECTORIES field to pathnames would make the abstraction
completely system-independent.
DISCUSSION: >>Additional arguments, discussions, endorsements,
testimonials, etc. should go here.<<