This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: difference between (load "package.foo.bar") and require?


> > 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]