Strange error output for undefined macros inside macros
Kjetil S. Matheussen
k.s.matheussen@notam02.no
Fri Feb 2 00:09:00 GMT 2007
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))
:-)
More information about the Kawa
mailing list