This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: the right way to compile and load modules
- From: Charles Turner <chturne at gmail dot com>
- To: mikel evins <mevins at me dot com>
- Cc: Kawa mailing list <kawa at sourceware dot org>
- Date: Tue, 13 May 2014 08:29:53 +0100
- Subject: Re: the right way to compile and load modules
- Authentication-results: sourceware.org; auth=none
- References: <9F312D97-98C6-4F47-BDD9-B6CAF3868A28 at me dot com>
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