[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mixing different types of macros
From: |
Eric E Moore |
Subject: |
mixing different types of macros |
Date: |
Tue, 23 Apr 2002 20:05:58 +0100 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.2 |
I was trying to write a simple syncase macro to simplify creating some
classes with goops, but there's some confusing quoting going on.
The simplest example of the sort of thing is:
(use-modules (ice-9 syncase)
(oop goops))
(define-syntax my-define-class
(syntax-rules ()
((my-define-class name supers slot ...)
(define-class name supers slot ...))))
(my-define-class <someclass> () (someslot #:accessor someslot))
Which gives the error:
Backtrace:
In current input:
8: 0* (my-define-class <someclass> () (someslot #:accessor someslot))
8: 1 (define-class <someclass> (quote ()) (someslot (quote #:accessor)
someslot))
...
?: 2 (define <someclass> (class (quote ()) (someslot (quote #) someslot)
...))
?: 3* (class (quote ()) (someslot (quote #:accessor) someslot) ...)
<unnamed port>: In expression (class (quote ()) (someslot # someslot) ...):
<unnamed port>: malformed slot option list
ABORT: (goops-error)
Changing the macro to:
(define-syntax my-define-class
(syntax-rules ()
((my-define-class name supers slot ...)
(quote (define-class name supers slot ...)))))
Does have:
(my-define-class <someclass> () (someslot #:accessor someslot))
returning:
(define-class <someclass> () (someslot #:accessor someslot))
Which even evals to do the right thing...
Is there anyone who can explain what's going on, so I can figure out
how to do something that works?
-Eric
pgpCVhH6pSzVB.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- mixing different types of macros,
Eric E Moore <=