The problem your code has is that you call a function with a wrong number of arguments. The function has been created with an argument list of fewer elements.
See this:
CL-USER> (defmethod foo ((a string) (b string) &key) (list a b))
STYLE-WARNING:
Implicitly creating new generic function COMMON-LISP-USER::FOO.
#<STANDARD-METHOD FOO (STRING STRING) {1005603C53}>
Above says that DEFMETHOD
also creates the corresponding generic function, because there was none. That's fine. We could also use DEFGENERIC
to declare the generic function and its arguments. Here SBCL infers it from the method it sees.
The method has exactly two arguments. There are no keyword arguments. Let's call it from another function with a few, supposedly, keyword arguments.
CL-USER> (defun bar (baz) (foo baz baz :k1 10))
; in: DEFUN BAR
; (FOO BAZ BAZ :K1 10)
;
; caught STYLE-WARNING:
; The function was called with four arguments, but wants exactly two.
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
BAR
CL-USER>
Now SBCL tells us that we call the generic function with four arguments, even though the generic function has only two parameters.
In your case the declaration of U1
describes a function with two arguments. There are no keyword arguments for READ-DATA-VALUE
.
There are now several possible ways to deal with this:
use a
DEFGENERIC
to define the generic functionREAD-DATA-VALUE
with the argument list you really want to use and make sure all your methods follow it.Put all the arguments in all methods. In methods where they are not used, declare them to be ignorable.
allow other keyword arguments, &allow-other-keys, to allow different methods to have different sets of keyword arguments. Best do it also in the
DEFGENERIC
form.
Then:
CL-USER> (defmethod foo1 ((a string) (b string) &key &allow-other-keys)
(list a b))
STYLE-WARNING:
Implicitly creating new generic function COMMON-LISP-USER::FOO1.
#<STANDARD-METHOD FOO1 (STRING STRING) {10058AC193}>
CL-USER> (defun bar1 (baz) (foo1 baz baz :k1 10))
BAR1
You can see that SBCL no longer complains and assumes that the arguments are keyword arguments.
The drawback is that the Lisp compiler now assumes that you can use arbitrary keyword arguments for this generic function and can't tell you (also not at compile time) if you pass a wrong one.