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


Kjetil S. Matheussen wrote:
Well, I guess I can get away with it by using eval for the most esoteric stuff.

That is almost certainly the wrong solution. 90% is the time when people want to use eval it is the wrong think to do. (Number taken out of the air. But certainly eval is often misused.) Use eval to evaluate an expression from an external source - such as a user typing an expression in a form. And that's all.

Eval breaks lexical scoping, error checking, compiler optimization,
modules, etc.

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 ...))))))

I don't know if it is safe, but I'm 99% certain it's the wrong approach. You want to work *with* the compiler, not *against* it. -- --Per Bothner per@bothner.com http://per.bothner.com/


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