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]

Re: defmacro question


> ygrats@gmx.net writes:

> > I like macro defining macros, and this only can be achieved using
> > "defmacro" not "define-syntax", as it seems.
> 
> I think you shoudl be able to use define-syntax to define macros.
> If you can't, please send a test-case.

I used to do this in Common-Lisp. I have had a look at R5RS, but up to
now, I don't see how I can do something like the following in Scheme using
define-syntax.

(defmacro import-jtype (java-type scm-name)
  (let ((scm-name-string (string-append "j" (symbol->string scm-name))))
    `(begin
       (defmacro ,(string->symbol
                   (string-append "make-" scm-name-string))
         args
         `(apply make ,,java-type ',args))
       (defmacro ,(string->symbol
                   (string-append scm-name-string "?"))
         (obj)
         `(instance?  ,obj ,,java-type))
       (define ,(string->symbol scm-name-string)
         ,java-type))))

Cheers,

Martin

-- 
Homepage: http://jove.prohosting.com/~ygrats/
Mail: ygrats@gmx.net

Sent through GMX FreeMail - http://www.gmx.net

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