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]

Re: the right way to compile and load modules


Hi Mikel,

Can you post your test code so that the people on this list can see
what you're trying to do?

I did just run an experiment of my own, which resulted in unexpected behaviour:

;; foo.scm
(require bar)
(display (bar))

;; bar.scm
(define (bar) "message from bar")

At this point, the BAR procedure from bar.scm is publicly visible
(exported) as you correctly said. I'm guessing your first runtime
error is because you're not
requiring (using REQUIRE) or loading (using LOAD) the bar.scm file from foo.scm.

I now compile these files like so,
prompt> java kawa.repl -C bar.scm
prompt> java jawa.repl --main -C foo.scm

I'm guessing that you're second observation about Kawa "complains that
bar is exported but never defined" is because you're compiling bar.scm
with the --main switch.

Here's where I now get confused,

prompt> java foo
#<procedure bar>

What? I was expecting as output "message from bar", as you get in the REPL:

prompt> java kawa.repl
#|kawa:1|# (define (bar) "message from bar")
#|kawa:2|# (display (bar))
message from bar

In fact, if foo.scm is modified to this,

;; foo.scm
(define (bar) "message from bar")
(display (bar))

compiled like this,
prompt> java jawa.repl --main -C foo.scm

Then I see this,
prompt> java foo
message from bar

I this behaviour is a bug.

prompt> java kawa.repl --version
Kawa 1.14 (revision 7636M)
Copyright (C) 2013 Per Bothner


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