This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: defmacro: Null pointer exceptions with compiled files
On Sun, 2004-05-30 at 15:25, Per Bothner wrote:
> Chris Dean wrote:
>
> >>... I have put macros in individual files and compiled them as a
> >>separate compilations. The macros do not work if I load the compiled
> >>files instead of the .scm files.
> >
> >
> > Try using require instead. load will not use the separate compilation
> > unit that you want. Write if you want a more detailed example.
Thanks Chris. Per's comment helped me realise that I had to use kawa -C
instead of compile-file for require to (also not) work.
> True, I do recommend "Files compilation" [as the Kawa manual calls it]
> and (require <module>), rather than "Archive compilation" and (load
> "file"), as the former will integrate better with Java, and provide
> better namespace management, and better optimization.
Good to know.
> However, I do want "Files compilation" to work more-or-less
> transparently like other Lisp/Scheme systems that support compilation.
> As far I can tell, your test case *should* work.
It also appears to be broken with Files compilation:
(module-name <incanddec>)
(module-export inc dec)
(defmacro inc (var)
`(begin
(set! ,var (+ ,var 1))
,var))
(defmacro dec (var)
`(begin
(set! ,var (- var 1))
,var))
$ kawa -C inc-and-dec.scm
(compiling inc-and-dec.scm)
$ kawa
#|kawa:1|# (require <incanddec>)
#|kawa:2|# (let ((i 1)) (inc i))
<stdin>:2:14: evaluating syntax transformer 'inc' threw java.lang.NullPointerException
> Unfortunately, I have don't have time to debug this now. Could you
> enter it into the Kawa bugzilla, so we don't forget about it?
Will do. It's quite a showstopper.
Regards,
Adam