[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Argument lists: a proposal to shoot at
In the following function descriptions, assume that the argument
function has Q required parameters and P &optional parameters, and that
R, K, or A is true iff the function has respectively a &rest, &key, or
FUNCTION-MIN-ARGS function [Function]
Returns Q, the minimum number of arguments that must be supplied when
the function is called.
FUNCTION-MAX-ARGS function [Function]
Returns (AND (OR (NOT R) K) (+ Q P)), that is, the maximum number of
arguments, exclusive of arguments for keyword parameters, that may be
supplied when the function is called. A return value of NIL indicates
that there is no such maximum, that is, the function has a &rest
parameter and no &key parameters. (Note that if a function has keyword
parameters, exactly (+ Q P) arguments have to be supplied before the
arguments that will be interpreted for keyword parameters.)
FUNCTION-HAS-KEYWORD-PARAMETERS function [Function]
Returns two values, K and A.
FUNCTION-KEYWORD-PARAMETER-P function keyword [Function]
Returns two values. If the function directly accepts the keyword as the
name of a keyword parameter (that is, the keyword parameter appeared in
the parameter list of the function), then the values T T are returned.
If the function does not accept the keyword directly, but its parameter
list contained &allow-other-keywords, then the values T NIL are
returned. Otherwise the values NIL NIL are returned. Note that
FUNCTION-KEYWORD-PARAMETER-P may be correctly applied to any function,
even one that was not declared with &key (the values NIL NIL are always
returned for such a function).
FUNCTION-KEYWORD-PARAMETERS function [Function]
Returns a list of all keywords that the argument function accepts
directly. Note that FUNCTION-KEYWORD-PARAMETERS may be correctly
applied to any function, even one that was not declared with &key (an
empty list is always returned for such a function).
Point of design philosophy: &aux "parameters" aren't anybody's business
at this level of abstraction. I don't deny that for the sake of
debuggers this information, and such other information as the names of
parameters, may be desired.