This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: parameters not working?
- From: Per Bothner <per at bothner dot com>
- To: mikel evins <mevins at me dot com>, Kawa mailing list <kawa at sourceware dot org>
- Date: Tue, 13 May 2014 18:31:13 -0700
- Subject: Re: parameters not working?
- Authentication-results: sourceware.org; auth=none
- References: <9F312D97-98C6-4F47-BDD9-B6CAF3868A28 at me dot com> <5371CFD0 dot 7070708 at bothner dot com> <7D1A5D60-5997-4B7A-9176-8F6FA315F016 at me dot com> <ED4375FE-30EE-4ABC-A9DC-2C6C4D67A87A at me dot com> <54132084-D633-4AAA-B2A4-9008FF37F779 at me dot com> <407A6350-04B0-4EC7-A13C-5C1E02D3A482 at me dot com>
On 05/13/2014 06:19 PM, mikel evins wrote:
My next issue: parameters appear to work fine in interactive sessions from loaded files, but not in required or compiled files.
More specifically, if I define a parameter like so:
(define foo (make-parameter #f))
at the top level of a source file and then require or compile that file, I will find at run time that foo is bound to a null pointer.
I assume that this is because requiring or compiling the source file does not execute the toplevel forms (unless it's the main file).
Am I guessing correctly about the execution model of required and compiled code? If so, how are parameters meant to be used in compiled code?
No, that is supposed to work - and seems to do so:
[bothner@toshie work1]$ cat ~/tmp/pfoo.scm
(define foo (make-parameter #f))
(format #t "foo (in pfoo): ~w~%" (foo))
[bothner@toshie work1]$ cat ~/tmp/pbar.scm
(require pfoo)
(format #t "foo (in pbar): ~w~%" (foo))
[bothner@toshie work1]$ bin/kawa -C ~/tmp/pfoo.scm
(compiling /home/bothner/tmp/pfoo.scm to pfoo)
[bothner@toshie work1]$ bin/kawa -C ~/tmp/pbar.scm
(compiling /home/bothner/tmp/pbar.scm to pbar)
[bothner@toshie work1]$ bin/kawa pbar
foo (in pfoo): #f
foo (in pbar): #f
[bothner@toshie work1]$ bin/kawa --main -C ~/tmp/pbar.scm
(compiling /home/bothner/tmp/pbar.scm to pbar)
[bothner@toshie work1]$ java pbar
foo (in pfoo): #f
foo (in pbar): #f
Could you write a simple test-program that shows the problem?
Note it should be complete and self-contained, and we need to
see the command-line(s) you use to compile and run it.
(Note I'm testing with the latest Kawa from Subversion.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/