[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: continuing problems with require
- To: pshannon@iapetus.cv.nrao.edu (Paul Shannon)
- Subject: Re: continuing problems with require
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Wed, 18 Aug 1993 10:31:16 -0500
- Cc: info-mcl
At 2:34 PM 8/18/93 +0000, Paul Shannon wrote:
>I posted a few days ago, describing my confusion about the
>require function, and when it chooses to reload the file
>named as its argument.
>
>After a couple of helpful replies, and further experimentation,
>I find, alas, I'm still confused:
>
> - with small test files, require always reloads it's argument,
> if the named file has been re-evaluated and saved
>
> - with my actual program, which is about 200 lines divided 3:1
> between 2 files, require will only sometimes reload its
> argument.
>
> - the mcl reference, page 310, says
>
> "...It attempts to load the files in module if they have
> not already been loaded."
>
> which, to me, says nothing about what it will do if the files
> have changed since they were last loaded.
>
>I'm prepared -- even expecting -- to discover that my problems are
>due to some dumb mistake I've made.
>
>I'm still hoping someone can straighten me out. And perhaps the
>able folks in Cambridge will provide a better description of how
>require is supposed to behave in the presence of changed files?
>Is require designed to load files which are assumed to be stable,
>and thus not frequently reloaded in an edit-eval-test cycle?
If (REQUIRE <module>) notices <module> on *modules* (using a case-sensitive
compare), it will not load it, e.g. if it has been loaded due to a previous
REQUIRE, or if (PROVIDE <module>) has been evaluated. Hence, REQUIRE's loading
has nothing whatsoever to do with whether the file has been changed since
it was last loaded. Your confusion probably comes from explicitly loading
a file that you later REQUIRE when the file contains no (PROVIDE <module>)
form. The initial load will not put <module> in *modules*, but the
REQUIRE will.
I cannot duplicate the behavior described by your first paragraph above:
"with small test files, require always reloads its argument...".
REQUIRE was indeed designed to load files which are assumed to be stable.
It is documented in CLtL2 pp. 277-278.
See the functions COMPILE-IF-CHANGED and LOAD-IF-CHANGED in the file
"ccl:interface tools;make-ift.lisp" for a simple way to track which versions
of files are loaded. I believe there are also some user-contributed DEFSYSTEM's
on the MCL 2.0 CD that handle this case correctly, though I don't know any
details.