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


My question was in the subject line: what's the right way to compile and load modules. By "right" I mean a way that works both when batch-compiling kawa for packaging in a jar and when interactively loading sources for repl-session development.

The answer appears to be that for interactive loading, one should use a load file that consists of a series of require forms, one for each source file, and the load file should reside in the same directory as the sources. That approach loads all of our code and silences the warnings I was previously seeing. (I still see warnings about symbols that are not visibly referenced anywhere, but that is an accurate and informative warning, so I have no complaint).

For compiling, the answer is that each source file must have a module-export form that exports each symbol that is used in some other source file. That's contrary to what the kawa docs say, but I found that in practice I saw a number of problems if I didn't use module-export forms to expose a file's definitions. In some cases kawa refused to complete the compile; in others it built everything without complaint, but crashed into a stack trace at runtime on an undefined location.

Using module-export cures these symptoms.

Since this is contrary to the kawa docs, I'm open to the possibility that I'm still doing something wrong that causes the unexpected behavior.



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