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]

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
fine.

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.

JP Verkamp


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