- (error "constant name not a symbol: ~S" name))
- (about-to-modify name)
- (let ((kind (info :variable :kind name)))
- (case kind
- (:constant
- ;; Note 1: This behavior (discouraging any non-EQL
- ;; modification) is unpopular, but it is specified by ANSI
- ;; (i.e. ANSI says a non-EQL change has undefined
- ;; consequences). If people really want bindings which are
- ;; constant in some sense other than EQL, I suggest either just
- ;; using DEFVAR (which is usually appropriate, despite the
- ;; un-mnemonic name), or defining something like
- ;; SB-INT:DEFCONSTANT-EQX (which is occasionally more
- ;; appropriate). -- WHN 2000-11-03
- (unless (eql value
- (info :variable :constant-value name))
- (cerror "Go ahead and change the value."
- "The constant ~S is being redefined."
- name)))
- (:global
- ;; (This is OK -- undefined variables are of this kind. So we
- ;; don't warn or error or anything, just fall through.)
- )
- (t (warn "redefining ~(~A~) ~S to be a constant" kind name))))
- (when doc
- (setf (fdocumentation name 'variable) doc))
- (setf (symbol-value name) value)
- (setf (info :variable :kind name) :constant)
- (setf (info :variable :constant-value name) value)
+ (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))))