Changeset 13184


Ignore:
Timestamp:
01/25/11 21:56:33 (11 years ago)
Author:
ehuelsmann
Message:

Enhance error messages for improved user friendlyness, as requested by Blake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/clos.lisp

    r12982 r13184  
    14731473                  gf-keywords)))))))
    14741474
    1475 (defun check-method-lambda-list (method-lambda-list gf-lambda-list)
     1475(defun check-method-lambda-list (name method-lambda-list gf-lambda-list)
    14761476  (let* ((gf-restp (not (null (memq '&rest gf-lambda-list))))
    14771477         (gf-plist (analyze-lambda-list gf-lambda-list))
     
    14851485    (unless (= (length (getf gf-plist :required-args))
    14861486               (length (getf method-plist :required-args)))
    1487       (error "The method has the wrong number of required arguments for the generic function."))
     1487      (error "The method-lambda-list ~S ~
     1488              has the wrong number of required arguments ~
     1489              for the generic function ~S." method-lambda-list name))
    14881490    (unless (= (length (getf gf-plist :optional-args))
    14891491               (length (getf method-plist :optional-args)))
    1490       (error "The method has the wrong number of optional arguments for the generic function."))
     1492      (error "The method-lambda-list ~S ~
     1493              has the wrong number of optional arguments ~
     1494              for the generic function ~S." method-lambda-list name))
    14911495    (unless (eq (or gf-restp gf-keysp) (or method-restp method-keysp))
    1492       (error "The method and the generic function differ in whether they accept &REST or &KEY arguments."))
     1496      (error "The method-lambda-list ~S ~
     1497              and the generic function ~S ~
     1498              differ in whether they accept &REST or &KEY arguments."
     1499             method-lambda-list name))
    14931500    (when (consp gf-keywords)
    14941501      (unless (or (and method-restp (not method-keysp))
    14951502                  method-allow-other-keys-p
    14961503                  (every (lambda (k) (memq k method-keywords)) gf-keywords))
    1497         (error "The method does not accept all of the keyword arguments defined for the generic function.")))))
     1504        (error "The method-lambda-list ~S does not accept ~
     1505                all of the keyword arguments defined for the ~
     1506                generic function." method-lambda-list name)))))
    14981507
    14991508(declaim (ftype (function * method) ensure-method))
     
    15021511        (gf (find-generic-function name nil)))
    15031512    (if gf
    1504         (check-method-lambda-list method-lambda-list (generic-function-lambda-list gf))
     1513        (check-method-lambda-list name method-lambda-list
     1514                                  (generic-function-lambda-list gf))
    15051515        (setf gf (ensure-generic-function name :lambda-list method-lambda-list)))
    15061516    (let ((method
     
    21402150          (gf (find-generic-function function-name nil)))
    21412151      (if gf
    2142           (check-method-lambda-list method-lambda-list (generic-function-lambda-list gf))
    2143           (setf gf (ensure-generic-function function-name :lambda-list method-lambda-list)))
     2152          (check-method-lambda-list function-name
     2153                                    method-lambda-list
     2154                                    (generic-function-lambda-list gf))
     2155        (setf gf (ensure-generic-function function-name :lambda-list method-lambda-list)))
    21442156      (let ((method
    21452157             (make-instance-standard-reader-method gf
     
    29602972
    29612973(defmethod find-method ((generic-function standard-generic-function)
    2962       qualifiers specializers &optional (errorp t))
     2974                        qualifiers specializers &optional (errorp t))
    29632975  (%find-method generic-function qualifiers specializers errorp))
    29642976
    29652977(defgeneric add-method (generic-function method))
    29662978
    2967 (defmethod add-method ((generic-function standard-generic-function) (method method))
     2979(defmethod add-method ((generic-function standard-generic-function)
     2980                       (method method))
    29682981  (let ((method-lambda-list (method-lambda-list method))
    29692982        (gf-lambda-list (generic-function-lambda-list generic-function)))
    2970     (check-method-lambda-list method-lambda-list gf-lambda-list))
     2983    (check-method-lambda-list (%generic-function-name generic-function)
     2984                              method-lambda-list gf-lambda-list))
    29712985  (%add-method generic-function method))
    29722986
Note: See TracChangeset for help on using the changeset viewer.