[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proposals 2, 3, & 4
Last call for comments on these. They're all related, so I'll put all
three in the smae message. I favor 2, 3A, and 4, though I really don't
care much whether 3A or 3B is chosen. Most of the discussion centered
around the exact format of these functions, whether a fast version as in
3A is needed, and whether we should do all of this with TYPE-OF instead.
I think that the TYPE-OF idea hs been effectively shot down in later
discussion.
There has been little discussion of issue 4, the semi-standard interface
for getting the parameter names, but I think that this is potentially
quite useful and costs very little to adopt, since implmentors are free
to make it a no-op.
---------------------------------------------------------------------------
Proposal #2: Argument List Information
Proposed Extension:
(FUNCTION-PARAMETERS <function>)
Takes one argument which must be a function, not a macro or special
form.
Returns the following six values:
1. Number of required parameters in the function's lambda list.
2. Number of optional parameters in the function's lambda list.
3. T if the function's lambda list contains the &REST lambda-keyword;
NIL otherwise.
4. T if the function's lambda list contains the &KEY lambda-keyword;
NIL otherwise.
5. A list of all keywords accepted by the function, in arbitrary order.
This list may be pre-stored, so it should not be destructively
modified by the user.
6. T if the function's lambda list contains the &ALLOW-OTHER-KEYS
lambda-keyword; NIL otherwise.
If return value 4 is NIL, 5 and 6 must also be NIL.
---------------------------------------------------------------------------
Proposal #3: Argument List Information
Two alternatives to choose from:
#3A:
Proposed extension:
FUNCTION-PARAMETER-RANGE (function)
The argument must be a function, not a macro or special form. Returns
two values, the minimum legal number of arguments and the maximum legal
number of arguments. If the function's argument list contains &rest or
&key, the second return value is NIL, meaning that there is no maximum
number of arguments.
- OR -
#3B:
Modification to proposal #2:
Add an implementation note to FUNCTION-PARAMETER recommending that
implementations detect calls that will not use the 5th value, and that
they compile such calls in a way that will not cons up a keyword list.
---------------------------------------------------------------------------
Proposal #4: Argument Name Information
Proposed extension:
(FUNCTION-PARAMETER-NAMES <function>)
Takes one argument which must be a function, not a macro or special
form.
This function returns the names of the parameters to a function, as
specified in the argument list, if such information is available. An
implementation may choose to provide this information for all functions,
only for some, or for none. The final return value specifies whether
the information is in fact available. If this is NIL, the other return
values will also be NIL.
Returns four values:
1. A list containing the symbols naming the required parameters, in order.
2. A list containing the symbols naming the optional parameters, in order.
3. A symbol naming the rest parameter, if any.
4. T if the information returned by this function is valid; NIL otherwise.
Note: This function is included primarily for the convenience of users and to
provide a uniform interface for portable debugging tools.