- (unless (getf initargs :allow-other-keys)
- ;; Now check the supplied-initarg-names and the default initargs
- ;; against the total set that we know are legal.
- (doplist (key val) initargs
- (unless (memq key legal)
- (if error-p
- (error 'simple-program-error
- :format-control "Invalid initialization argument ~S for class ~S"
- :format-arguments (list key (class-name class)))
- (return-from check-initargs-2-plist nil)))))
- t)
+ (let ((invalid-keys ()))
+ (unless (getf initargs :allow-other-keys)
+ ;; Now check the supplied-initarg-names and the default initargs
+ ;; against the total set that we know are legal.
+ (doplist (key val) initargs
+ (unless (or (memq key legal)
+ ;; :ALLOW-OTHER-KEYS NIL gets here
+ (eq key :allow-other-keys))
+ (push key invalid-keys)))
+ (when (and invalid-keys error-p)
+ (error 'initarg-error :class class :initargs invalid-keys)))
+ invalid-keys))