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?


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/


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