Subject: Re: return-from / defmacro question From: Erik Naggum <erik@naggum.no> Date: 1999/04/16 Newsgroups: comp.lang.lisp Message-ID: <3133245123205645@naggum.no> * Rudolf Schlatte <rschlatt@ist.tu-graz.ac.at> | CLtL2 says that defmacro is enclosed in an implicit block statement ... you appear to view macros in a suboptimal way. a macro is nothing more than a function, but it is called by the compiler (or interpreter) and its value is used in place of the call. this is called macro expansion, because the macro call is expanded into the value of the called macro. in other words, there is no label in scope after returning from a macro function any more than there is a label in scope after returning from any other function. or, fixing another faulty view of macros: there is no magic to its value. the value is what you specify it to be and nothing more. perhaps this helps, and perhaps not, but I'll make a shot at it: (defmacro foo (x y z) `(list ,x ,y ,z)) defines a macro that simply makes (foo a b c) turn into (list a b c). nothing particularly exciting, but the following might be instructive. this is the function that DEFMACRO has constructed. (pprint (function-lambda-expression (macro-function 'foo))) => (lambda (excl::**macroarg** excl::..environment..) (declare (ignore-if-unused excl::..environment..)) (excl::dt-macro-argument-check 3 3 excl::**macroarg** :macro) (block foo (let* () (let* ((#:g142396 (cdr excl::**macroarg**)) (x (excl::car-fussy #:g142396 'x)) (y (excl::car-fussy (cdr #:g142396) 'y)) (z (excl::car-fussy (cdr (cdr #:g142396)) 'z)) (#:g142397 (excl::lambdascan-maxargs 0 (cdr (cdr (cdr #:g142396))) '(x y z)))) (declare (ignore-if-unused #:g142397)) `(list ,x ,y ,z))))) when you understand this (or at least appreciates what it does), you should be able to understand the macroexpansion of the DEFMACRO form: (pprint (macroexpand '(defmacro foo (x y z) `(list ,x ,y ,z)))) good luck! #:Erik -- environmentalists are much too concerned with planet earth. their geocentric attitude prevents them from seeing the greater picture -- lots of planets are much worse off than earth is.