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

Issues: REQUIRE-PATHNAME-DEFAULTS and LOAD-TRUENAME



I had this stuff filed under the name LOAD-TRUENAME. But do they really
want to modify the default pathname for LOAD, or is it really REQUIRE? If
REQUIRE did have a default pathname, should it be the same as LOADs? 

Somehow I don't think we will get away from the issue of "default loading
behavior" merely by outlawing REQUIRE.


     ----- Begin Forwarded Messages -----

Date: Tue, 13 Dec 88 20:49 EST
 From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
Subject: Possible issue: LOAD-TRUENAME
To: Dave.Touretzky@cs.cmu.edu
cc: KMP@STONY-BROOK.SCRC.Symbolics.COM, Masinter.PA
In-Reply-To: <2131.598064664@DST.BOLTZ.CS.CMU.EDU>

I agree that the issue is one that comes up a lot. 

I think Genera offers a variable that lets you know what file is being
loaded.  It might hold the name of the source file in a binary file load,
I forget.

For CL, maybe a variable (or function) to give the truename of the file
being LOADed or a list of the truenames of all files being loaded (most
recent first). A variation on this facility for use in COMPILE-FILE would
be useful as well.

Would that level of functionality suffice?

[I'm leary about your suggestion of LOAD binding variables that people
 already assume LOAD doesn't bind. As to adding weird special-purpose
 keywords to LOAD, knowing the name of the file being loaded may be
 useful to other things besides LOAD, so I'd rather provide a more 
 general facility for getting at this information that would suffice for
 other uses.]

Masinter may tell me it's too late to consider this kind of change,
but especially since there's a recognition that REQUIRE and PROVIDE are
bankrupt, and since CLtL's pathname stuff doesn't address all the file
problems which commonly come up in portable programs, maybe I can sneak
this in under the umbrella of a number of other file- (ok, pathname-) 
related proposals we're about to hit X3J13 with if we come up with
something
sufficiently concrete and non-controversial in a hurry.

Some straw men:

 - Variables *LOAD-TRUENAME* and *COMPILE-FILE-TRUENAME* which hold the
   truename of the innermost file being loaded or compiled, respectively,
   during the dynamic invocation of LOAD and COMPILE-FILE.

 - Variables *LOAD-TRUENAMES* and *COMPILE-FILE-TRUENAMES* which hold lists
   of the truenames of all files being loaded or compiled, respectively,
   during the dynamic invocation of LOAD and COMPILE-FILE.

 - Variable *LOAD-OR-COMPILE-FILE-TRUENAMES* which holds a list like
   ((LOAD truename) (COMPILE-FILE truename) ...)
   during the dynamic invocation of LOAD and COMPILE-FILE.

Better names solicited, of course.


     ----- Next Message -----

Sender: Common-Lisp-mailer%SAIL.Stanford:EDU:Xerox
Date: 14 Dec 88 08:45
 From: MURRAY%cs.umass:EDU:Xerox
Subject: RE: load defaults
To: common-lisp%sail.stanford:EDU:Xerox

Return-Path: <Common-Lisp-mailer@SAIL.Stanford.EDU>
Redistributed: Xerox-Common-Lispâ??.x
Received: from SAIL.Stanford.EDU ([36.86.0.194]) by Xerox.COM ; 14 DEC 88
08:45:49 PST
Received: from crash.cs.umass.edu ([128.119.40.235]) by SAIL.Stanford.EDU
with TCP; 14 Dec 88  08:13:15 PST
Received: from vax2.cs.umass.edu by crash.cs.umass.edu (5.59/Ultrix2.0-B)
id AA02232; Wed, 14 Dec 88 11:14:26 est
Message-Id: <8812141614.AA02232@crash.cs.umass.edu>
Original-Date: Wed, 14 Dec 88 11:11 EST
X-Vms-To: IN%"common-lisp@sail.stanford.EDU"


> 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




     ----- Next Message -----

Sender: Common-Lisp-mailer%SAIL.Stanford:EDU:Xerox
Date: 14 Dec 88 10:21
 From: cperdue%Sun:COM:Xerox
Subject: RE: load defaults
To: Dave.Touretzky%B.GP.CS.CMU:EDU:Xerox, MURRAY%cs.umass:EDU:Xerox,
common-lisp%sail.stanford:EDU:Xerox

GVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGV
 From: cperdue@Sun.COM (Cris Perdue)
To: Dave.Touretzky@B.GP.CS.CMU.EDU, MURRAY@cs.umass.EDU,
common-lisp@sail.stanford.EDU
Subject: RE: load defaults
Return-Path: <Common-Lisp-mailer@SAIL.Stanford.EDU>
Redistributed: Xerox-Common-Lispâ??.x
Received: from SAIL.Stanford.EDU ([36.86.0.194]) by Xerox.COM ; 14 DEC 88
10:21:42 PST
Received: from Sun.COM by SAIL.Stanford.EDU with TCP; 14 Dec 88  09:59:23
PST
Received: from snail.Sun.COM by Sun.COM (4.1/SMI-4.0)	id AA28669; Wed, 14
Dec 88 09:59:57 PST
Received: from clam.sun.com by snail.Sun.COM (4.1/SMI-4.0)	id AA27264; Wed,
14 Dec 88 09:56:35 PST
Received: by clam.sun.com (3.2/SMI-3.2)	id AA14360; Wed, 14 Dec 88 09:57:31
PST
Original-Date: Wed, 14 Dec 88 09:57:31 PST
Message-Id: <8812141757.AA14360@clam.sun.com>
GVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGV

Some implementations of Common Lisp include a special variable
with a name like *source-pathname*, which is bound appropriately
by LOAD.  This supports what is commonly known as "source code
recording" and if added to Common Lisp would meet needs such
as Touretzky's.  We have found need for this at Sun and would
be happy to see such a thing in the language at some time.

				-Cris




     ----- Next Message -----

Sender: Common-Lisp-mailer%SAIL.Stanford:EDU:Xerox
Date: 14 Dec 88 16:49
Reply-to: Dave.Touretzky%cs.cmu:EDU:Xerox
Subject: Re: load defaults
In-Reply-to: Your message of Wed, 14 Dec 88 11:11:00 -0500.
<8812141614.AA02232@crash.cs.umass.edu>
 From: Dave.Touretzky%B.GP.CS.CMU:EDU:Xerox
To: common-lisp%sail.stanford:EDU:Xerox

Return-Path: <Common-Lisp-mailer@SAIL.Stanford.EDU>
Redistributed: Xerox-Common-Lispâ??.x
Received: from SAIL.Stanford.EDU ([36.86.0.194]) by Xerox.COM ; 14 DEC 88
16:43:13 PST
Received: from DST.BOLTZ.CS.CMU.EDU by SAIL.Stanford.EDU with TCP; 14 Dec
88  16:19:18 PST
Received: from DST.BOLTZ.CS.CMU.EDU by DST.BOLTZ.CS.CMU.EDU; 14 Dec 88
19:17:08 EST
Original-Date: Wed, 14 Dec 88 19:16:51 EST
Message-ID: <3154.598148211@DST.BOLTZ.CS.CMU.EDU>

> Date: Wed, 14 Dec 88 11:11 EST 
> From: MURRAY@cs.umass.EDU
>
>  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)))

This is a nice idea, but it doesn't solve my problem.  The user would have
to type in the whole definition before he could use it to load the header
file I referred to.  I want to avoid inconveniencing the user; he should be
able to just start up a fresh Lisp, LOAD a single header file, and have
everything else happen automatically.

I like KMP's proposals.  I like the second one best: have separate
variables for files being loaded and files being compiled, and use them to
maintain a stack so we can see the nesting of loads within files.

-- Dave




     ----- Next Message -----

Sender: Common-Lisp-mailer%SAIL.Stanford:EDU:Xerox
Date: 16 Dec 88 01:41
 From: jonl%lucid:COM:Xerox
In-Reply-to: Dave.Touretzky@B.GP.CS.CMU.EDU's message of Tue, 13 Dec 88
20:04:24 EST <2131.598064664@DST.BOLTZ.CS
Subject: file loading query
To: Dave.Touretzky%cs.cmu:EDU:Xerox
cc: common-lisp%sail.stanford:EDU:Xerox

GVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGV
 From: Jon L White <jonl@lucid.com>
To: Dave.Touretzky@cs.cmu.edu
Cc: common-lisp@sail.stanford.edu
In-Reply-To: Dave.Touretzky@B.GP.CS.CMU.EDU's message of Tue, 13 Dec 88
20:04:24 EST <2131.598064664@DST.BOLTZ.CS.CMU.EDU>
Subject: file loading query
Return-Path: <Common-Lisp-mailer@SAIL.Stanford.EDU>
Redistributed: Xerox-Common-Lispâ??.x
Received: from SAIL.Stanford.EDU ([36.86.0.194]) by Xerox.COM ; 16 DEC 88
01:41:40 PST
Received: from lucid.com by SAIL.Stanford.EDU with TCP; 16 Dec 88  01:22:59
PST
Received: from bhopal ([192.9.200.13]) by heavens-gate.lucid.com id
AA00971g; Fri, 16 Dec 88 01:20:08 PST
Received: by bhopal id AA20998g; Fri, 16 Dec 88 01:22:08 PST
Original-Date: Fri, 16 Dec 88 01:22:08 PST
Message-Id: <8812160922.AA20998@bhopal>
GVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGVGV

re: 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?

I doubt that there's a portable trick.  Lucid Common Lisp supports an
extension as follows:
    (defvar *load-pathname* nil
      "During a load, this is bound to the pathname of the file being
loaded.")
and ocasionally it is used to find out what directory the currently
loading file is on, so that a related file can be loaded from the same
directory.


-- JonL --




     ----- End Forwarded Messages -----