This is the mail archive of the kawa@sources.redhat.com 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]

Problem with macro while compiling


I found problem with Kawa 1.6.71 (downloaded form cvs), while compiling code which
use a macro at top level of .scm files.
I have included 4 sample files (record.scm, test1.scm, test2.scm, test3.scm) to help
reproducing the bug (see details further).
 
For example:
 
(define-syntax the-macro ; <-- the macro
    (.....))
 
(the-macro 1 2 3)   <-- using the macro
 
-When the macro and the use of the macro are in the same file, the compilation produces
not error message (test3.scm). When the macro is defined in an other file (record.scm),
compiled, then loaded using 'require', the compilation produces a warning (test2.scm):
test\test2.scm:3:2: warning - calling define-record-type which is not a procedure
 
-When loading the files test1.scm, test2.scm and test3.scm with 'load', it does work ;-)
But when loading them with 'require' from kawa command line, test1.scm and test2.scm
produce:
#|kawa:1|# (require <test.test1>)
Invalid parameter, was: kawa.lang.Macro
java.lang.ClassCastException: kawa.lang.Macro
 at gnu.mapping.Constraint.getProcedure(Constraint.java:28)
 at gnu.mapping.Binding.getProcedure(Binding.java:23)
 at test.test1.run(test\test1.scm:3)
 at kawa.standard.require.find(require.java:51)
 at kawa.standard.require.find(require.java:26)
 at kawa.standard.require.scanForDefinitions(require.java:119)
 
I had a look in the byte code, a Procedure Object what awaited.
 
Loading test3.scm using 'require' produce a strange:
#|kawa:1|# (require <test.test3>)
gnu.mapping.UnboundSymbol: Unbound symbol make-test
 at kawa.standard.ScmEnvConstraint.get(ScmEnv.java:74)
 at gnu.mapping.Constraint.getProcedure(Constraint.java:28)
 at gnu.mapping.Binding.getProcedure(Binding.java:23)
 at test.test3.run(test\test3.scm:41)
 at kawa.standard.require.find(require.java:51)
 at kawa.standard.require.find(require.java:26)
 
Is there restriction on the use of macro with compilation? I hope I can patch my code with
loads instead of requires ;-)
 
------------------------------------------------------
I have included 4 sample file to help reproducing the bug. They should be put in a folder
called 'test', and should be compiled with the package prefix 'test.'
Here is what I use:
 
java -cp ../kawa-1.6.71:.   kawa.repl  -P test. -C test/record.scm
java -cp ../kawa-1.6.71:.   kawa.repl  -P test. -C test/test1.scm
java -cp ../kawa-1.6.71:.   kawa.repl  -P test. -C test/test2.scm
test\test2.scm:3:2: warning - calling define-record-type which is not a procedure
java -cp ../kawa-1.6.71:.   kawa.repl  -P test. -C test/test3.scm
java -cp ../kawa-1.6.71:.    kawa.GuiConsole
 
 

record.scm

test1.scm

test2.scm

test3.scm


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