This is the mail archive of the kawa@sourceware.org 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: the right way to compile and load modules


On May 13, 2014, at 3:01 AM, mikel evins <mevins@me.com> wrote:

>> A possible problem is that load is line-by-line, which is fundamentally
>> incompatible with modules as a unit - and thus with export.  If you use
>> load, leave off the exports.
> 
> If I leave off the exports I cannot compile.
> 
> I can try requiring or importing from the repl and see how that works

Okay, that didn't work out so well.

I've been using load because a couple of people are working on this project and the exact paths to the sources are not going to be the same across machines. It's convenient to use load because I can simply find out the path to the load file at launch time and then compute the pathnames to all the sources, then for-each over those paths to load them.

That doesn't work the same way with import or require, since they're syntax and don't evaluate their arguments.

How can I make a system load file that will import or require all of the sources of a project into an interactive session without using load?

This does not work:

(define (load-client)
  (require "/Users/mikel/Workshop/fabric/scm/src/invoke.scm"))

...yielding an error like this:

#|kawa:1|# #|kawa:2|# cannot find module invoke
	at gnu.expr.ModuleContext.findInstance(ModuleContext.java:55)
	at gnu.expr.ModuleInfo.getInstance(ModuleInfo.java:272)
	at kawa.standard.require.find(require.java:120)
	at atInteractiveLevel$7.loadClient(load-fabric.scm:62)
	at atInteractiveLevel$7.apply0(load-fabric.scm:61)
	at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:186)
	at gnu.expr.ModuleMethod.apply(ModuleMethod.java:160)
	at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
	at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:373)
	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:210)
	at kawa.Shell.run(Shell.java:279)
	at kawa.Shell.run(Shell.java:194)
	at kawa.Shell.run(Shell.java:175)
	at kawa.repl.main(repl.java:871)


I can load the file interactively at the repl, but loading a few dozen files interactively at the repl every time I start a session is going to be a non-starter.



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