X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdefmacro.lisp;h=9a794452b1977b90421260bbf7bb82839c039d0b;hb=90ca09b75fbc3b63b2f7d09c67b04b866dd783f6;hp=9ec1d2b25ef1cf8781de2db52767f492b2e8be18;hpb=cea4896b2482b7b2b429c1631d774b4cfbc0efba;p=sbcl.git diff --git a/src/code/defmacro.lisp b/src/code/defmacro.lisp index 9ec1d2b..9a79445 100644 --- a/src/code/defmacro.lisp +++ b/src/code/defmacro.lisp @@ -35,22 +35,23 @@ ;;; still useful in the target interpreter, and in the ;;; cross-compilation host. (defun sb!c::%defmacro (name definition lambda-list doc) - (try-to-rename-interpreted-function-as-macro definition name lambda-list) + (declare (ignore lambda-list)) (sb!c::%%defmacro name definition doc)) ;;; (called by SB!C::%DEFMACRO) (eval-when (:compile-toplevel :load-toplevel :execute) (defun sb!c::%%defmacro (name definition doc) - ;; Old note (ca. 1985, maybe:-): "Eventually %%DEFMACRO should deal with - ;; clearing old compiler information for the functional value." + ;; old note (ca. 1985, maybe:-): "Eventually %%DEFMACRO should + ;; deal with clearing old compiler information for the functional + ;; value." (clear-info :function :where-from name) ;; FIXME: It would be nice to warn about DEFMACRO of an ;; already-defined macro, but that's slightly hard to do because ;; in common usage DEFMACRO is defined at compile time and then ;; redefined at load time. We'd need to make a distinction between ;; the defined-at-compile-time state and the defined-at-load-time - ;; state to make this work. (Trying to warn about duplicate DEFTYPEs - ;; runs into the same problem.) + ;; state to make this work. (Trying to warn about duplicate + ;; DEFTYPEs runs into the same problem.) #+nil (when (sb!xc:macro-function name) (style-warn "redefining ~S in DEFMACRO" name)) (setf (sb!xc:macro-function name) definition @@ -77,21 +78,18 @@ ;;; DEFMACRO-MUNDANELY is like SB!XC:DEFMACRO, except that it doesn't ;;; have any EVAL-WHEN or IR1 magic associated with it, so it only ;;; takes effect in :LOAD-TOPLEVEL or :EXECUTE situations. -;;; -;;; KLUDGE: Currently this is only used for various special -;;; circumstances in bootstrapping, but it seems to me that it might -;;; be a good basis for reimplementation of DEFMACRO in terms of -;;; EVAL-WHEN, which might be easier to understand than the current -;;; approach based on IR1 magic. -- WHN 19990811 (def!macro defmacro-mundanely (name lambda-list &body body) - `(setf (sb!xc:macro-function ',name) - ,(let ((whole (gensym "WHOLE-")) - (environment (gensym "ENVIRONMENT-"))) - (multiple-value-bind (new-body local-decs doc) - (parse-defmacro lambda-list whole body name 'defmacro - :environment environment) - (declare (ignore doc)) - `(lambda (,whole ,environment) - ,@local-decs - (block ,name - ,new-body)))))) + (let ((whole (gensym "WHOLE-")) + (environment (gensym "ENVIRONMENT-"))) + (multiple-value-bind (new-body local-decs doc) + (parse-defmacro lambda-list whole body name 'defmacro + :environment environment) + `(progn + (setf (sb!xc:macro-function ',name) + (lambda (,whole ,environment) + ,@local-decs + (block ,name + ,new-body))) + (setf (fdocumentation ',name 'macro) + ,doc) + ',name))))