This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: the right way to compile and load modules
- From: mikel evins <mevins at me dot com>
- To: Per Bothner <per at bothner dot com>
- Cc: mikel evins <mevins at me dot com>, kawa at sourceware dot org
- Date: Tue, 13 May 2014 03:01:54 -0500
- Subject: Re: the right way to compile and load modules
- Authentication-results: sourceware.org; auth=none
- References: <9F312D97-98C6-4F47-BDD9-B6CAF3868A28 at me dot com> <5371CFD0 dot 7070708 at bothner dot com>
On May 13, 2014, at 2:54 AM, Per Bothner <per@bothner.com> wrote:
> On 05/12/2014 09:09 PM, mikel evins wrote:
>> Okay, so I add a module-export form to bar.scm and recompile.
>> Now foo.class runs as expected, but there's a new problem: if I load bar.scm, kawa complains that bar is exported but never defined.
>
> 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.
> Better to always use require (or r7rs import). You can use require to
> import a source file (though you can't yet use import for that).
> I don't have an example - it late, I'm tired, and my initial experiment
> is doing something weird. :-(
Another point: I was using parameters for certain things, but getting null pointer exceptions when referencing them in compiled code. I'm guessing that the compiled modules did not execute the toplevel defines that should have defined the parameters. I suppose that might reasonbly be an expected result, though it's a little inconvenient.