[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: load defaults

> From: Dave.Touretzky@B.GP.CS.CMU.EDU
>I have a problem with the way Common Lisp says pathname defaults should be
> handled during load...

My initial reaction is that you should be using some sort of defsystem,
which gives you much more control over sets of files.
But maybe you're trying to run bare-bones.  

>1. Anybody know a *portable* trick I can use to get embedded calls to LOAD
>to use the parent file's pathname as a default?

There is no portable way to find out what pathname is currently being
loaded.  The portable way to get your desired behavior is simply to define your own
load function that will bind *DEFAULT-PATHNAME-DEFAULTS* to the file it
is loading before it calls the real load.
   (defun default-load (input &rest args)
     (let ((*default-pathname-defaults* (merge-pathnames input)))
       (apply 'load *default-pathname-defaults* args)))

>2. How terrible would it be for LOAD to rebind *DEFAULT-PATHNAME-DEFAULTS* ?

Probably not too terrible, but it does create another instance of
a problem that some people have complained about.  By having LOAD bind
a special variable, it make it impossible to have the contents of a
file side-effect that variable after the load.  This is a current problem
with *package*.

>3. Alternatively, what would people think of adding a :PARENT-PATH keyword
>to LOAD.  With a value of T this keyword would mean "if this is an embedded
>load, get default pathname information from the pathname of the parent
>file" ?

Surely you jest!

Kelly Murray