I was able to try this work-around today. Unfortunately, the change causes
other errors when I load .scm files into the environment. Specifically, I'm
getting an "Unbound symbol new" exception:
Caused by: gnu.mapping.UnboundSymbol: Unbound symbol new
at gnu.expr.Interpreter.getDefaultSymbolValue(Interpreter.java:638)
at gnu.expr.Interpreter.getSymbolValue(Interpreter.java:645)
at atFileLevel.apply(c:/Documents and Settings/hurst/My
Documents/build/scm/src/topology.scm:42)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:258)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:188)
at kawa.standard.load.loadSource(load.java:176)
at kawa.standard.load.loadSource(load.java:131)
The file topology.scm contains a number of definitions like the following:
(define-namespace NetworkInterface "class:com.lisletech.NetworkInterface")
(define nif-new NetworkInterface:new)
So I suspect the unbound symbol is coming from one of these definitions, but
I don't understand why the interpreter should think that the "new" method is
undefined. It worked just fine before I made the change to load.java.
In any event, it doesn't look like I'll be able to use this change to
load.java to solve my problem with catching exceptions in my Java code that
were thrown from the Scheme code. I'm investigating another approach in
which the .scm file contains only definitions and doesn't actually execute
anything and then the function that might throw an exception is called
directly from Java using eval(). This works, but it is a little bit awkward
for what I want to do. I'd really like to be able to execute the same code
either loaded interactively or called from Java. Any suggestions for other
approaches would be appreciated.