0.7.3.1:
[sbcl.git] / src / code / macros.lisp
index bc9ba0e..5ee726a 100644 (file)
@@ -31,8 +31,8 @@
    some locations known to SETF, starting over with test-form. Returns NIL."
   `(do () (,test-form)
      (assert-error ',test-form ',places ,datum ,@arguments)
-     ,@(mapcar #'(lambda (place)
-                  `(setf ,place (assert-prompt ',place ,place)))
+     ,@(mapcar (lambda (place)
+                `(setf ,place (assert-prompt ',place ,place)))
               places)))
 
 (defun assert-prompt (name value)
@@ -180,6 +180,32 @@ the usual naming convention (names like *FOO*) for special variables"
        (info :variable :constant-value name) value)
   name)
 \f
+;;;; DEFINE-SYMBOL-MACRO
+
+(defmacro-mundanely define-symbol-macro (name expansion)
+  `(eval-when (:compile-toplevel :load-toplevel :execute)
+    (sb!c::%define-symbol-macro ',name ',expansion)))
+
+(defun sb!c::%define-symbol-macro (name expansion)
+  (unless (symbolp name)
+    (error 'simple-type-error :datum name :expected-type 'symbol
+          :format-control "Symbol macro name is not a symbol: ~S."
+          :format-arguments (list name)))
+  (ecase (info :variable :kind name)
+    ((:macro :global nil)
+     (setf (info :variable :kind name) :macro)
+     (setf (info :variable :macro-expansion name) expansion))
+    (:special
+     (error 'simple-program-error
+           :format-control "Symbol macro name already declared special: ~S."
+           :format-arguments (list name)))
+    (:constant
+     (error 'simple-program-error
+           :format-control "Symbol macro name already declared constant: ~S."
+           :format-arguments (list name))))
+  name)
+
+\f
 ;;;; DEFINE-COMPILER-MACRO
 
 ;;; FIXME: The logic here for handling compiler macros named (SETF
@@ -448,7 +474,7 @@ the usual naming convention (names like *FOO*) for special variables"
   code in BODY to provide possible further output."
   `(%print-unreadable-object ,object ,stream ,type ,identity
                             ,(if body
-                                 `#'(lambda () ,@body)
+                                 `(lambda () ,@body)
                                  nil)))
 
 (defmacro-mundanely ignore-errors (&rest forms)