12.2.6 Return-value congruence
Like parameter lists, the value declarations of a generic function and that function's methods must be congruent. The rules depend on whether the generic function returns a fixed or a variable number of values:
If the generic function returns a fixed number of values — that is, it does not have
#restin its value declaration — then its methods cannot have#rest, and must return the same number of required values as the generic function. For each method, the type of each returned value must be a subtype of the same returned value in the generic function.If the generic function returns a variable number of values — that is, it has
#restin its value declaration — then its methods can (but are not required to) have#rest, and must return at least as many required values as the generic function. For each method, the type of each returned value must be a subtype of the same returned value in the generic function. If the method has more required returned values than the generic function, their types must all be subtypes of the generic function's#restvalue.
The following value declarations are congruent, because the generic function implicitly returns any number of values of any type:
define generic g (arg1 :: <complex>, arg2 :: <integer>);
define method g
(arg1 :: <real>, arg2 :: <integer>) => (result :: <real>)
...
end method g;
The following value declarations are not congruent, because the type of the method's returned value is not a subtype of the generic function's returned value:
define generic g
(arg1 :: <complex>, arg2 :: <integer>) => (result :: <integer>);
define method g
(arg1 :: <real>, arg2 :: <integer>) => (result :: <real>)
...
end method g;




