This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: "unbound location string->number"
Steve Smith wrote:
I've done some more investigation on this and there's definitely
something funny going on. To test I've created the following Scheme
and Java classes:
;; test-inline.scm
(define-simple-class <SchemeTest> (<java.lang.Object>)
((decode (number :: <java.lang.String>))
:: <java.lang.Integer>
(let ((num (string->number "1234")))
(<java.lang.Integer>:new num))))
You're thinking this defines a class SchemeTest. It does that,
but more precisely it exports a name <SchemeTest> from a module.
And the value of the name is different for each "instance" of the
module. This matters when there are module-level variables.
// JavaTest.java
import java.lang.*;
import au.com.isay.test.SchemeTest;
public class JavaTest {
public static void main(String []args) {
SchemeTest scm = new SchemeTest();
System.out.println("Test run: " + scm.decode("1234") + "\n");
}
}
# Compile
/opt/kawa-snapshot/bin/kawa -P au.com.isay.test. -C test-inline.scm
javac -classpath . JavaTest.java
You almost certainly want to compile with --module-static or
--module-static-run.
--
--Per Bothner
per@bothner.com http://per.bothner.com/