public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Peter Lane <peter@peterlane.info>
To: kawa@sourceware.org
Subject: environments and eval with user-defined library
Date: Sat, 18 Feb 2017 16:36:00 -0000	[thread overview]
Message-ID: <b826247d-6335-b280-d5d5-e5d1ee111b24@peterlane.info> (raw)

I've been using eval and environment as follows:

#|kawa:1|# (define env (environment '(srfi 1)))
#|kawa:2|# (environment-bound? env 'iota)
#t
#|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)
#t
#|kawa:3|# (eval '(test-me) env)
Exception in thread "main" java.lang.ExceptionInInitializerError
     at atEvalLevel-1.run(stdin:3)
     at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:293)
     at gnu.expr.ModuleExp.evalModule(ModuleExp.java:212)
     at kawa.lang.Eval.evalBody(Eval.java:100)
     at kawa.lang.Eval.evalForm$X(Eval.java:27)
     at kawa.lib.scheme.eval.eval$X(eval.scm:9)
     at atInteractiveLevel-3.run(stdin:3)
     at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:293)
     at gnu.expr.ModuleExp.evalModule(ModuleExp.java:212)
     at kawa.Shell.run(Shell.java:283)
     at kawa.Shell.run(Shell.java:196)
     at kawa.Shell.run(Shell.java:183)
     at kawa.repl.processArgs(repl.java:714)
     at kawa.repl.main(repl.java:820)
Caused by: java.lang.ClassNotFoundException: lib.test
     at gnu.mapping.WrappedException.rethrow(WrappedException.java:121)
     at gnu.expr.Compilation.setupLiterals(Compilation.java:2984)
     at lib.test.<clinit>(test.sld)
     ... 14 more
Caused by: java.lang.ClassNotFoundException: lib.test
     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     at gnu.bytecode.ArrayClassLoader.loadClass(ArrayClassLoader.java:132)
     at gnu.bytecode.ArrayClassLoader.loadClass(ArrayClassLoader.java:132)
     at gnu.expr.Compilation.setupLiterals(Compilation.java:2965)
     ... 15 more

--
Peter Lane
http://peterlane.info

             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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=b826247d-6335-b280-d5d5-e5d1ee111b24@peterlane.info \
    --to=peter@peterlane.info \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).