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]

Mutual require bug when compiling?


Following up on the earlier duplicate require problems that we were
encountering, we¹ve come across what seems to be a problem with mutual
requires when compiling, which may be related.

I¹m posting this on behalf of Teong Leong, who is working on the same
project, as his posting seems to have bounced.

thanks,
Alex

-----Original Message-----
From: Chuah Teong Leong
Sent: Mon 8/3/2009 11:46 PM
To: kawa@sources.redhat.com
Subject: mutual require bug
 
Hi I'm one of the programmer working on alex mitchell's code
Previously we had some duplicate require problem and sometimes some
undefined variable problem.

I suspect we might have some mutual require bug that might be the root to
the problem. 
Anyway we need this bug to be fixed to see whether this had been the root of
our problem 

Consider the below scenario.
file1.scm requires both file2.scm and file3.scm.
file2.scm requires file3.scm
file3.scm requires file2.scm

we had always tested our program using load file from inside eclipse with
the schemeway plugin
loading file1.scm works fine. file2.scm can see the variables in file3.scm
and vice versa. 

I discovered that when compiling the program into a java class using
java -cp $CLASSPATH:. kawa.repl -d build --main -C file1.scm
does not behave the same way as (load "file1.scm")
it behaved more like (require "file1.scm")

I begin to use load file0.scm to test file1.scm and it produced the same
error as when I was trying to compile file1.scm

Loading file1.scm works but loading file0.scm (essentially executing
(require "file1.scm")) gives an exception:

#|kawa:1|# unbound location var3    at
gnu.mapping.Location.get(Location.java:67)    at
file2.testFunc2(file2.scm:6)    at file1.run(file1.scm)    at
gnu.expr.ModuleBody.run(ModuleBody.java:44)    at
gnu.expr.ModuleBody.run(ModuleBody.java:32)    at
atInteractiveLevel$2.run(file0.scm:1)    at
gnu.expr.ModuleExp.evalModule2(ModuleExp.java:295)    at
gnu.expr.ModuleExp.evalModule(ModuleExp.java:176)    at
kawa.Shell.run(Shell.java:273)    at
kawa.standard.load.loadSource(load.java:115)    at
kawa.standard.load.apply(load.java:236)    at
kawa.standard.load.apply(load.java:179)    at
kawa.standard.load.apply2(load.java:154)    at
kawa.standard.load.apply1(load.java:145)    at
gnu.mapping.Procedure.apply(Procedure.java:112)    at
gnu.mapping.Procedure.apply(Procedure.java:95)    at
gnu.mapping.CallContext.runUntilDone(CallContext.java:251)    at
gnu.expr.ModuleExp.evalModule2(ModuleExp.java:352)    at
gnu.expr.ModuleExp.evalModule(ModuleExp.java:176)    at
kawa.Shell.run(Shell.java:273)    at kawa.Shell.run(Shell.java:184)    at
kawa.Shell.run(Shell.java:165)    at kawa.repl.processArgs(repl.java:395)
at kawa.repl.main(repl.java:866) test-func2 #|kawa:2|#
 

;-------file0.scm---------
(require "file1.scm")

;-------file1.scm---------
(require "file2.scm")
(require "file3.scm")

(test-func2) 
(test-func3) 

;------file2.scm----------
(require "file3.scm")

(define var2 2) 
(test-func3) 
(define (test-func2)
   (display "test-func2 ")
   (display var3)(newline))

;------file3.scm---------
(require "file2.scm")

(define var3 3) 
(test-func2) 
(define (test-func3)
   (display "test-func3 ")
   (display var2)(newline))

am I onto something or am I missing something?
I'm using kawa-1.9.3 and I've successfully compiled a test program so
I do not think the way I'm going about compiling the program is the problem.

Teong Leong 

------ End of Forwarded Message



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