Strange error output for undefined macros inside macros

Kjetil S. Matheussen k.s.matheussen@notam02.no
Fri Feb 2 02:07:00 GMT 2007



On Fri, 2 Feb 2007, Kjetil S. Matheussen wrote:

>
>
> On Thu, 1 Feb 2007, Per Bothner wrote:
>
>>  Kjetil S. Matheussen wrote:
>> >   Okay, I figured it might have been easy since it knows that foobar is a
>> >   macro.
>>
>>  Yes, but the relationship to foo is harder to discern.  Besides, it's a
>>  more general problem:
>>
>>  (define (foo) (foobar))
>>
>>  (define-syntax foobar ...)
>> 
>> > >   In any case, define-macro is *strongly* deprecated.  Don't use it.
>> > >   I should probably have it cause a warning ...
>> > 
>> > 
>> >   Is defmacro okay?
>>
>>  No.  defmacro and define-macro are basically the same.  They're kludges.
>>  You can use them if you want, but don't don't complain if something
>>  doesn't work.
>> 
>
> Thats really bad. I mentally need low-level macros. Lisp is not worth 
> programming without being able to fiddle with the symbols before evaluating.
>
> But I couldn't understand what was the problem with defmacro in this post: 
> http://sourceware.org/ml/kawa/2006-q4/msg00020.html
> Can you give an example of a case where defmacro might lead to trouble?
>


Well, I guess I can get away with it by using eval for the most esoteric 
stuff. Is the code below safe?

(define (low-level-macro-helper all)
   (eval `(dosomethingcoolwith ,@all)))

(define-syntax low-level-macro
   (syntax-rules ()
     ((_ arg1 arg2 ...) (def-class-helper (quote (arg1 arg2 ...))))))



More information about the Kawa mailing list