From: Len Charest
Subject: Re: Finding the file extensions for LISP source and object files?
Date: 
Message-ID: <1992Apr14.012534.19025@jpl-devvax.jpl.nasa.gov>
In article <·····················@umbc3.umbc.edu>, ········@umbc5.umbc.edu (cs106241) writes:
|> 
|> Is there a CLtL/1 way to find out the file extension for a source file
|> (eg "lisp" or "LISP") or an object file ("fas, "fasl", etc)? Using the
|> CLtL/2 version, I think I could find out the extension for lisp files
|> by using make-pathname with the new :case keyword. But even there I
|> cannot figure out how to figure out what the object file's extension will

These extensions are merely a convention established by the particular implementation of Lisp that you are using, *not* a set of defaults established by the filesystem. The :case keyword in CLtL2, when given a value of :local, "means that strings given to make-pathname...follow the local file system's convention for alphabetic case." [CLtL2, p 618] Therefore the :case keyword has nothing to do with defaulting pathname components.
 
Lisp itself offers no built-in way to determine what the 'correct' extensions are for a given implementation. In fact, even if you know a priori the source extension for your implementation, there is nothing preventing a programmer from using something entirely different. The best you can do is assume that programmers will adhere to conventions. Then use the read macro #+ to conditionalize your code for various implementations. For example:

(defun load-source (pathname)
  (load (make-pathname :case :local
                       :defaults pathname
                       :type #+foolisp "FOOL"
                             ;;otherwise
                             #-foolisp "lisp")))
..................................................
                                  Len Charest, Jr.
                 JPL Artificial Intelligence Group
                          ·······@aig.jpl.nasa.gov