This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
RE: difference between (load "package.foo.bar") and require?
- From: "Dominique Boucher" <dominique dot boucher at nuecho dot com>
- To: "'Per Bothner'" <per at bothner dot com>
- Cc: "'Hoehle, Joerg-Cyril'" <Joerg-Cyril dot Hoehle at t-systems dot com>, <kawa at sources dot redhat dot com>
- Date: Thu, 27 May 2004 14:05:13 -0400
- Subject: RE: difference between (load "package.foo.bar") and require?
- Reply-to: <dominique dot boucher at nuecho dot com>
> > When loading a file, all top-level definitions are added to the
> > top-level interaction environment. The loading is done by
> 'load' using
> > a custom class loader. That's why it does not take into
> account the .jar files.
>
> It does use the same ClassLoader as when you're evaluating
> expressions, which is an ArrayClassLoader. If you load a
> file-compiiled-to-zip, it uses a separate ZipLoader.
You stand me corrected, here.
> > If you want to access some loaded code from within Kawa modules
> > compiled using kawa -C, you'll have to use 'eval'.
>
> Not sure what you're referring to here.
I should have been clearer.
If you have references to undefined identifiers in your module, you don't
need eval, of course. But I don't like that. Your module is no longer
self-contained. It depends on a properly setup top-level environment.
So one alternative is to do the following:
(let ((top-level-function (eval 'top-level-function
(interaction-environment))))
(top-level-function ...))
Dominique Boucher