This is the mail archive of the
mailing list for the Kawa project.
Using Kawa as an embedded scripting language
- From: John-Paul Verkamp <verkampj at umail dot iu dot edu>
- To: Kawa mailing list <kawa at sourceware dot org>
- Date: Thu, 25 Aug 2011 13:45:36 -0400
- Subject: Using Kawa as an embedded scripting language
I'm writing a project uses Kawa as an embedded scripting language, but
one part of the behavior is a little puzzling.
I'm doing this:
Scheme kawa = new Scheme();
kawa.eval("(define add1 (lambda (n) (+ n 1)))");
But when I try to use the add1:
Object result = kawa.eval("(add1 5)");
I'm getting a NoSuchFieldError from the ModuleExp class.
Alternatively, if I use kawa.defineFunction(...) to define add1 or put
in in a file and use kawa.eval("(load \"add1.ss\")") it works just
I managed to work around the issue for the time being by automatically
wrapping any top-level S-expressions that I pass to kawa.eval with
Scheme's eval; for example:
kawa.eval("(eval '(define add1 (lambda (n) (+ n 1))))")
But that feels hacky (and doesn't work with some more complicated forms).
Is there something I'm doing wrong / should be doing to make this work?
Thanks ahead of time for any assistance.