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: Per Bothner <per at bothner dot com>
- To: "Hoehle, Joerg-Cyril" <Joerg-Cyril dot Hoehle at t-systems dot com>
- Cc: kawa at sources dot redhat dot com, dominique dot boucher at nuecho dot com
- Date: Thu, 27 May 2004 09:41:32 -0700
- Subject: Re: difference between (load "package.foo.bar") and require?
- References: <5F9130612D07074EB0A0CE7E69FD7A0344FE1F@S4DE8PSAAGS.blf.telekom.de>
Hoehle, Joerg-Cyril wrote:
So I thought: let's compile using
kawa --module-static (seemed right to me) -Pjch. -C f1.scm and then use
(require <jch.f1>)
(require <jch.f2>)
Require also provides namespace management.
So if jch.f2 depends on (uses definitions from) jch.f1, then you
really should add a (require <jch.f1>) in jch.f2. Etc.
"require" is not the same as a textual "include"! Though it might be
handy to also imlement a textual (or sexpr-level) include.
If you don't want to change your files, perhaps it makes most sense
to concatenate the "modules":
cat fch/f1.scm fch/f2.scm >fch/f.scm
kawa --module-static -C fch/f.scm
However, that gives you line numbers referring to f.scm.
For Kawa, the recommended procedure is to add the needed require
statements. Think of require as "import" in languages with modules.
(Java's import isn't quite the same, but related.)
An (include "filename") macro would be nice, and wouldn't be too
difficult to write, but it's not trivial either. A reader macro
would probably be easier, but uglier.
--
--Per Bothner
per@bothner.com http://per.bothner.com/