Fri 18 Nov 2011 11:43:43 PM UTC, original submission:
1. Create a library 'messages.scm' with two functions:
(define hello
(lambda (name)
(format "hello ~a" name)))
(define goodbye
(lambda (name)
(format "goodbye ~a" name)))
2. Compile using the kawac Ant task.
3. Create a program "controller.scm" to use the above defined functions
(require <com.example.messages>)
(format #t "~a~%" (com.example.messages:hello "world"))
Compile (using kawac as before)
Run: java -cp build/classes:kawa-1.11.jar com.example.controller
Output: "hello world"
4. Now try to do the same thing from the repl
Start the repl:
java -cp build/classes:kawa-1.11.jar kawa.repl
then at the prompt:
(require <com.example.messages>) [ENTER]
(format "~a~!" (com.example.messages:goodbye "world"))
and get the output:
"no slot 'goodbye' in com.example.messages"
6. Workaround: If I explicitly use (export goodbye) in messages.scm then the repl finds the method ok.
I was not expecting this difference in behaviours between invocation direct and invocation at the repl. Possibly same as bug report #32726?
|