SBCL to wager that this (undefined in ANSI) operation would be safe.
3:
- It should cause a STYLE-WARNING, not a full WARNING, when a structure
- slot default value does not match the declared structure slot type.
- (The current behavior is consistent with SBCL's behavior elsewhere,
- and would not be a problem, except that the other behavior is
- specifically required by the ANSI spec.)
+ ANSI specifies that a type mismatch in a structure slot
+ initialization value should not cause a warning.
+WORKAROUND:
+ This one might not be fixed for a while because while we're big
+ believers in ANSI compatibility and all, (1) there's no obvious
+ simple way to do it (short of disabling all warnings for type
+ mismatches everywhere), and (2) there's a good portable
+ workaround. ANSI justifies this specification by saying
+ The restriction against issuing a warning for type mismatches
+ between a slot-initform and the corresponding slot's :TYPE
+ option is necessary because a slot-initform must be specified
+ in order to specify slot options; in some cases, no suitable
+ default may exist.
+ In SBCL, as in CMU CL (or, for that matter, any compiler which
+ really understands Common Lisp types) a suitable default does
+ exist, in all cases, because the compiler understands the concept
+ of functions which never return (i.e. has return type NIL, e.g.
+ ERROR). Thus, as a portable workaround, you can use a call to
+ some known-never-to-return function as the default. E.g.
+ (DEFSTRUCT FOO
+ (BAR (ERROR "missing :BAR argument")
+ :TYPE SOME-TYPE-TOO-HAIRY-TO-CONSTRUCT-AN-INSTANCE-OF))
+ or
+ (DECLAIM (FTYPE () NIL) MISSING-ARG)
+ (DEFUN REQUIRED-ARG () ; workaround for SBCL non-ANSI slot init typing
+ (ERROR "missing required argument"))
+ (DEFSTRUCT FOO
+ (BAR (REQUIRED-ARG) :TYPE TRICKY-TYPE-OF-SOME-SORT)
+ (BLETCH (REQUIRED-ARG) :TYPE TRICKY-TYPE-OF-SOME-SORT)
+ (N-REFS-SO-FAR 0 :TYPE (INTEGER 0)))
+ Such code will compile without complaint and work correctly either
+ on SBCL or on a completely compliant Common Lisp system.
4:
It should cause a note, not a WARNING, when the system ignores
** The TOP debugger command is also gone, since it's redundant with the
FRAME 0 command, and since it interfered with abbreviations for the
TOPLEVEL restart.
-* removed bug 21 from BUGS, since Martin Atzmueller points out that
- it doesn't seem to affect SBCL after all
* The system now recovers better from non-PACKAGE values of the *PACKAGE*
variable.
* The system now understands compound CONS types (e.g. (CONS FIXNUM T))
files, thanks to a patch originally from Douglas Crosher.
* Martin Atzmueller also fixed ROOM, so that it no longer fails with an
undefined function error.
+* gave up on fixing bug 3 (forbidden-by-ANSI warning for type mismatch
+ in structure slot initforms) for now, wrote workaround instead:-|
+* fixed bug 4 (no WARNING for DECLAIM FTYPE of slot accessor function)
+* removed bug 21 from BUGS, since Martin Atzmueller points out that
+ it doesn't seem to affect SBCL after all
planned incompatible changes in 0.7.x:
* The debugger prompt sequence now goes "5]", "5[2]", "5[3]", etc.
"MAKE-OTHER-IMMEDIATE-TYPE" "MAKE-RANDOM-TN"
"MAKE-REPRESENTATION-TN" "MAKE-RESTRICTED-TN" "MAKE-SC-OFFSET"
"MAKE-STACK-POINTER-TN" "MAKE-TN-REF" "MAKE-UNWIND-BLOCK"
- "MAKE-VALUE-CELL" "MAKE-WIRED-TN" "META-PRIMITIVE-TYPE-OR-LOSE"
+ "MAKE-VALUE-CELL" "MAKE-WIRED-TN" "MAYBE-COMPILER-NOTE"
+ "META-PRIMITIVE-TYPE-OR-LOSE"
"META-SB-OR-LOSE" "META-SC-NUMBER-OR-LOSE" "META-SC-OR-LOSE"
"MORE-ARG-CONTEXT" "MOVABLE" "MOVE" "MULTIPLE-CALL"
"MULTIPLE-CALL-LOCAL" "MULTIPLE-CALL-NAMED"
format-args))
(values))
+;;; Issue a note when we might or might not be in the compiler.
+(defun maybe-compiler-note (&rest rest)
+ (if (boundp '*lexenv*) ; if we're in the compiler
+ (apply #'compiler-note rest)
+ (let ((stream *error-output*))
+ (pprint-logical-block (stream nil :per-line-prefix ";")
+
+ (format stream " note: ~3I~_")
+ (pprint-logical-block (stream nil)
+ (apply #'format stream rest)))
+ (fresh-line stream)))) ; (outside logical block, no per-line-prefix)
+
;;; The politically correct way to print out progress messages and
;;; such like. We clear the current error context so that we know that
;;; it needs to be reprinted, and we also Force-Output so that the
(error "not a function type: ~S" (first args)))
(dolist (name (rest args))
(cond ((info :function :accessor-for name)
- (warn "ignoring FTYPE proclamation for slot accessor:~% ~S"
- name))
+ ;; FIXME: This used to be a WARNING, which was
+ ;; clearly wrong, since it would cause warnings to
+ ;; be issued for conforming code, which is really
+ ;; annoying for people who use Lisp code to build
+ ;; Lisp systems (and check the return values from
+ ;; COMPILE and COMPILE-FILE). Changing it to a
+ ;; compiler note is somewhat better, since it's
+ ;; after all news about a limitation of the
+ ;; compiler, not a problem in the code. But even
+ ;; better would be to handle FTYPE proclamations
+ ;; for slot accessors, and since in the long run
+ ;; slot accessors should become more like other
+ ;; functions, this should eventually become
+ ;; straightforward.
+ (maybe-compiler-note
+ "~@<ignoring FTYPE proclamation for ~
+ slot accessor (currently unsupported): ~2I~_~S~:>"
+ name))
(t
;; KLUDGE: Something like the commented-out TYPE/=
;;; versions, and a string like "0.6.5.12" is used for versions which
;;; aren't released but correspond only to CVS tags or snapshots.
-"0.6.8.21"
+"0.6.8.22"