Skip to content

Commit

Permalink
0.8alpha.0.39:
Browse files Browse the repository at this point in the history
	A couple more CLOS fixes:
	... make &OPTIONAL argument count checking less lax in methods
		(caught by pfdietz' MAKE-LOAD-FORM.ERROR.2)
	... make :ARGUMENT-PRECEDENCE-ORDER and :METHOD-COMBINATION
		DEFGENERIC options do sanity checking on their arguments
		(:A-P-O caught by pfdietz' suite; :M-C
		checking defensively installed :-)
  • Loading branch information
csrhodes committed May 19, 2003
1 parent 9f8b254 commit 301bcbc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
5 changes: 5 additions & 0 deletions NEWS
Expand Up @@ -1755,6 +1755,11 @@ changes in sbcl-0.8.0 relative to sbcl-0.8alpha.0
STRUCTURE-OBJECT, CONDITION and STANDARD-OBJECT.
** MAKE-LOAD-FORM-SAVING-SLOTS no longer returns a special
keyword, and now implements the SLOT-NAMES argument.
** methods with &OPTIONAL arguments no longer allow too many
arguments to be passed in the call without error.
** DEFGENERIC now checks that the :ARGUMENT-PRECEDENCE-ORDER
option is consistent with the required arguments of the generic
function lambda list.

planned incompatible changes in 0.8.x:
* (not done yet, but planned:) When the profiling interface settles
Expand Down
41 changes: 34 additions & 7 deletions src/pcl/boot.lisp
Expand Up @@ -190,11 +190,32 @@ bootstrapping.
is not allowed inside DEFGENERIC."
:format-arguments (list (cadr option))))
(push (cadr option) (initarg :declarations)))
((:argument-precedence-order :method-combination)
(if (initarg car-option)
(duplicate-option car-option)
(setf (initarg car-option)
`',(cdr option))))
(:method-combination
(when (initarg car-option)
(duplicate-option car-option))
(unless (symbolp (cadr option))
(error 'simple-program-error
:format-control "METHOD-COMBINATION name not a ~
symbol: ~S"
:format-arguments (list (cadr option))))
(setf (initarg car-option)
`',(cdr option)))
(:argument-precedence-order
(let* ((required (parse-lambda-list lambda-list))
(supplied (cdr option)))
(unless (= (length required) (length supplied))
(error 'simple-program-error
:format-control "argument count discrepancy in ~
:ARGUMENT-PRECEDENCE-ORDER clause."
:format-arguments nil))
(when (set-difference required supplied)
(error 'simple-program-error
:format-control "unequal sets for ~
:ARGUMENT-PRECEDENCE-ORDER clause: ~
~S and ~S"
:format-arguments (list required supplied)))
(setf (initarg car-option)
`',(cdr option))))
((:documentation :generic-function-class :method-class)
(unless (proper-list-of-length-p option 2)
(error "bad list length for ~S" option))
Expand Down Expand Up @@ -1173,8 +1194,14 @@ bootstrapping.
(aux `(,var))))))
(let ((bindings (mapcan #'process-var lambda-list)))
`(let* ((,args-tail ,args)
,@bindings)
(declare (ignorable ,args-tail))
,@bindings
(.dummy0.
,@(when (eq state 'optional)
`((unless (null ,args-tail)
(error 'simple-program-error
:format-control "surplus arguments: ~S"
:format-arguments (list ,args-tail)))))))
(declare (ignorable ,args-tail .dummy0.))
,@body)))))

(defun get-key-arg-tail (keyword list)
Expand Down
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -17,4 +17,4 @@
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
"0.8alpha.0.38"
"0.8alpha.0.39"

0 comments on commit 301bcbc

Please sign in to comment.