public inbox for
 help / color / mirror / Atom feed
From: Peter Lane <>
Subject: environments and eval with user-defined library
Date: Sat, 18 Feb 2017 16:36:00 -0000	[thread overview]
Message-ID: <> (raw)

I've been using eval and environment as follows:

#|kawa:1|# (define env (environment '(srfi 1)))
#|kawa:2|# (environment-bound? env 'iota)
#|kawa:3|# (eval '(iota 10) env)
(0 1 2 3 4 5 6 7 8 9)

Although this works for builtin libraries (like srfi 1), this does not 
appear to work for my own libraries, e.g. below.  Notice on line two, 
the symbol is bound in the environment, so (lib test) seems to be found 
and loaded into 'env'. But during 'eval' there is no lib.test class found.

I'm running Kawa in r7rs mode, with the library in "./lib/test.sld":

$ kawa --r7rs -Dkawa.import.path="./*.sld"

Is this a limitation in the implementation?  Or do I need to give kawa 
some more information?

#|kawa:1|# (define env (environment '(lib test)))
#|kawa:2|# (environment-bound? env 'test-me)
#|kawa:3|# (eval '(test-me) env)
Exception in thread "main" java.lang.ExceptionInInitializerError
     at gnu.expr.ModuleExp.evalModule2(
     at gnu.expr.ModuleExp.evalModule(
     at kawa.lang.Eval.evalBody(
     at kawa.lang.Eval.evalForm$X(
     at kawa.lib.scheme.eval.eval$X(eval.scm:9)
     at gnu.expr.ModuleExp.evalModule2(
     at gnu.expr.ModuleExp.evalModule(
     at kawa.repl.processArgs(
     at kawa.repl.main(
Caused by: java.lang.ClassNotFoundException: lib.test
     at gnu.mapping.WrappedException.rethrow(
     at gnu.expr.Compilation.setupLiterals(
     at lib.test.<clinit>(test.sld)
     ... 14 more
Caused by: java.lang.ClassNotFoundException: lib.test
     at java.lang.ClassLoader.loadClass(
     at sun.misc.Launcher$AppClassLoader.loadClass(
     at java.lang.ClassLoader.loadClass(
     at gnu.bytecode.ArrayClassLoader.loadClass(
     at gnu.bytecode.ArrayClassLoader.loadClass(
     at gnu.expr.Compilation.setupLiterals(
     ... 15 more

Peter Lane

             reply	other threads:[~2017-02-18 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18 16:36 Peter Lane [this message]
2017-02-24  7:48 ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).