This is the mail archive of the kawa@sourceware.org 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]
Other format: [Raw text]

Re: Strange error output for undefined macros inside macros




On Thu, 1 Feb 2007, Per Bothner wrote:

Kjetil S. Matheussen wrote:

When evaluating the following


 "
 (define-macro (foo)
   (foobar))
 (define-macro (foobar)
   (display 520))
 (foo)
 "

I get the following error:

 "Argument  (#<macro foobar>) to 'apply-to-args' has wrong type
 (kawa.lang.Macro) (expected: procedure)"

 It took me a long time to figure out that foobar needed to be evaluated
 before foo. (of course, I didn't have this small example then. :-) )

 Perhaps it would be better to say something like "The foobar macro needs
 to be defined before defining foo" instead?

That might be difficult. It might be possible to say something like: macro was not processed at compile-time


Okay, I figured it might have been easy since it knows that foobar is a macro.



In any case, define-macro is *strongly* deprecated.  Don't use it.
I should probably have it cause a warning ...


Is defmacro okay?

And in case, can I do this?

(defmacro define-macro (def . body)
  `(defmacro ,(car def) ,(cdr def) ,@body))

:-)



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