ANSI spec, bare 'MEMBER, 'AND, and 'OR are not legal types, CMUCL
(and now SBCL) interpret them as legal types.
-44:
- ANSI specifies DEFINE-SYMBOL-MACRO, but it's not defined in SBCL.
- CMU CL added it ca. Aug 13, 2000, after some discussion on the mailing
- list, and it is probably possible to use substantially the same
- patches to add it to SBCL.
-
45:
a slew of floating-point-related errors reported by Peter Van Eynde
on July 25, 2000:
changes in sbcl-0.7.2 relative to sbcl-0.7.1:
* cleanups on SPARC, both Linux and Solaris, and for gcc>=3 (thanks
to Christophe Rhodes and Nathan Froyd)
- * DESCRIBE on a symbol now says something about DEFTYPE-style
- expansions associated with the symbol (thanks to Eric Marsden's
- patch for CMU CL).
+ * ANSI's DEFINE-SYMBOL-MACRO is now supported. (thanks to Nathan
+ Froyd porting CMU CL code)
+ * The fasl file format has changed again, to allow the compiler's
+ INFO database to support symbol macros.
planned incompatible changes in 0.7.x:
* When the profiling interface settles down, maybe in 0.7.x, maybe
(let* ((kind (info :variable :kind x))
(wot (ecase kind
(:special "special variable")
+ (:macro "symbol macro")
(:constant "constant")
(:global "undefined variable")
(:alien nil))))
(sb-alien::heap-alien-info-type info)))
(format s "~@<Its current value is ~3I~:_~S.~:>"
(eval x))))
+ ((eq kind :macro)
+ (let ((expansion (info :variable :macro-expansion x)))
+ (format s "~@:_It is a ~A with expansion ~S." wot expansion)))
((boundp x)
(format s "~@:_~@<It is a ~A; its ~_value is ~S.~:>"
wot (symbol-value x)))
;;; versions which break binary compatibility. But it certainly should
;;; be incremented for release versions which break binary
;;; compatibility.
-(defconstant +fasl-file-version+ 25)
+(defconstant +fasl-file-version+ 26)
;;; (record of versions before 0.7.0 deleted in 0.7.1.41)
;;; 23 = sbcl-0.7.0.1 deleted no-longer-used EVAL-STACK stuff,
;;; causing changes in *STATIC-SYMBOLS*.
;;; called from macroexpanded code
;;; 25 = sbcl-0.7.1.41 (and immediately preceding versions, actually)
;;; introduced new functions to check for control stack exhaustion
+;;; 26 = sbcl-0.7.2.4 or so added :VARIABLE :MACRO-EXPANSION to INFO codes
;;; the conventional file extension for our fasl files
(declaim (type simple-string *fasl-file-type*))
#!+sb-doc
"If form is a macro (or symbol macro), expands it once. Returns two values,
the expanded form and a T-or-NIL flag indicating whether the form was, in
- fact, a macro. Env is the lexical environment to expand in, which defaults
+ fact, a macro. ENV is the lexical environment to expand in, which defaults
to the null environment."
(cond ((and (consp form) (symbolp (car form)))
(let ((def (sb!xc:macro-function (car form) env)))
((symbolp form)
(let* ((venv (when env (sb!c::lexenv-vars env)))
(local-def (cdr (assoc form venv))))
- (if (and (consp local-def)
- (eq (car local-def) 'macro))
- (values (cdr local-def) t)
- (values form nil))))
+ (cond ((and (consp local-def)
+ (eq (car local-def) 'macro))
+ (values (cdr local-def) t))
+ ((eq (info :variable :kind form) :macro)
+ (values (info :variable :macro-expansion form) t))
+ (t
+ (values form nil)))))
(t
(values form nil))))
(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
(define-info-type
:class :variable
:type :kind
- :type-spec (member :special :constant :global :alien)
+ :type-spec (member :special :constant :macro :global :alien)
:default (if (symbol-self-evaluating-p name)
:constant
:global))
name
(bug "constant lookup of nonconstant ~S" name)))
+;;; the macro-expansion for symbol-macros
+(define-info-type
+ :class :variable
+ :type :macro-expansion
+ :type-spec t
+ :default nil)
+
(define-info-type
:class :variable
:type :alien-info
;;; information from the global environment and enter it in
;;; *FREE-VARS*. If the variable is unknown, then we emit a warning.
(defun find-free-var (name)
- (declare (values (or leaf heap-alien-info)))
+ (declare (values (or leaf cons heap-alien-info))) ; see FIXME comment
(unless (symbolp name)
(compiler-error "Variable name is not a symbol: ~S." name))
(or (gethash name *free-vars*)
(case kind
(:alien
(info :variable :alien-info name))
+ ;; FIXME: The return value in this case should really be
+ ;; of type SB!C::LEAF. I don't feel too badly about it,
+ ;; because the MACRO idiom is scattered throughout this
+ ;; file, but it should be cleaned up so we're not
+ ;; throwing random conses around. --njf 2002-03-23
+ (:macro
+ (let ((expansion (info :variable :macro-expansion name))
+ (type (type-specifier (info :variable :type name))))
+ `(MACRO . (the ,type ,expansion))))
(:constant
(let ((value (info :variable :constant-value name)))
(make-constant :value value
:SECTION3-LEGACY-733
:SECTION3-LEGACY-750
:SECTION3-LEGACY-783
- :SECTION3-LEGACY-807
- :SECTION3-LEGACY-812
- :SECTION3-LEGACY-816
- :SECTION3-LEGACY-820
- :SECTION3-LEGACY-824
- :SECTION3-LEGACY-832
- :SECTION3-LEGACY-844
+ ;; DEFINE-SYMBOL-MACRO stuff fixed by NJF patch merged 2002-03-31:
+ ;; :SECTION3-LEGACY-807
+ ;; :SECTION3-LEGACY-812
+ ;; :SECTION3-LEGACY-816
+ ;; :SECTION3-LEGACY-820
+ ;; :SECTION3-LEGACY-824
+ ;; :SECTION3-LEGACY-832
+ ;; :SECTION3-LEGACY-844
:SECTION4-LEGACY-111
:SECTION4-LEGACY-115
:SECTION4-LEGACY-119
;;; for internal versions, especially for internal versions off the
;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.7.2.3"
+"0.7.2.4"