Problem with macro expansion

Colin Fleming colin.mailinglist@gmail.com
Wed Nov 25 11:38:00 GMT 2009


Hi all,

I'm just getting started with Kawa (and Scheme, really), so forgive me
if this is a basic question. I'm trying to use Kawa to write a plugin
for a Java app in Scheme. I have the following:

(module-name "scheme.Tokens")
(module-static #t)

(define-namespace IElement "class:com.intellij.psi.tree.IElementType")
(define-namespace Element
"class:org.jetbrains.plugins.scheme.parser.SchemeElementType")

(define-constant open-vector :: IElement (Element:new "#("))
(token open-vector "#(")

(define-syntax token
  (syntax-rules () ((_ name desc)
                    (define-constant name :: IElement (Element:new desc)))))

The (define-constant open-vector :: IElement (Element:new "#(")) is
what I'd like to make a macro out of, which should result in being
able to use the form (token open-vector "#(").

In the REPL this works, but when I try to compile the class, I get the error:

(compiling Tokens.scm to scheme.Tokens)
Tokens.scm:9:1: define-constant is only allowed in a <body>

Where 9:1 is the line of the macro invocation. Am I missing something
obvious here? This is with Kawa 1.9.90.

Thanks,
Colin



More information about the Kawa mailing list