Problem with compiled macro

Are Meisfjord are@meisfjord.com
Fri Dec 20 10:36:00 GMT 2002


Hello!


I have a problem with compiled macros. The problem seems to occur
only in some situations when the macro expands to a function
definition using #!key, #!rest or #!optional arguments. Example:

;;; begin test.scm
(defmacro defmaker (name . args) 
  `(define (,name #!key ,@args) (list ,@args)))
;;; end test.scm

C:\>java kawa.repl --module-static -C test.scm
(compiling test.scm)

C:\>java kawa.repl
#|kawa:1|# (load "test.class")
java.lang.VerifyError: (class: test, method: <clinit> signature: ()V)
Bad type in putfield/putstatic
        at java.lang.Class.forName0(Native Method)
        ...

I don't think there is anything wrong with the macro itself - it
works when it's loaded from the source rather than the compiled file:

#|kawa:2|# (load 'test.scm)
#|kawa:3|# (defmaker foo a b c)
#|kawa:4|# (foo)
(#f #f #f)
#|kawa:5|# (foo :b 1)
(#f 1 #f)

The problem disappears when '#!key' is removed from the macro
definition. But then of course the macro does not work the way I
wanted. Any comments?


Regards,

Are




More information about the Kawa mailing list