Search
Thursday, 22nd of July 2021, 18:31:33 UTC
19:02:50
dieggsy
is there a manual way of checking a list of arguments against the acceptable parameter list of a function without actually calling it?
19:03:26
dieggsy
basically check if an apply will succeed (based on num args, keywords, etc.) before actually applying it
19:11:36
Bike
dieggsy: no, for several reasons, first of which is that the implementation doesn't actually have to save the lambda list of a function
19:12:43
dieggsy
fair. a manual check it is then i suppose
20:08:06
aeth
dieggsy: there should be a way to do it because swank/slime displays the arguments in the minibuffer in emacs
20:08:20
aeth
I guess it's part of swank?
20:08:49
Bike
swank uses the introspection interfaces of some implementations
20:09:02
aeth
and worst case scenario, it's unparsed, but (alexandria:parse-ordinary-lambda-list '(x y &key z))
20:09:08
Bike
which, besides behing extensions, are intended for human use rather than anything programmatic so they can have inaccuracies
20:09:23
Bike
and on high optimization that information can be removed even on implementations that do sometimes save it
20:09:47
aeth
having high optimization disable some safety is almost a feature in and of itself
20:10:02
aeth
you can check to see if it exists before entering this part of the code
20:10:32
Bike
you can try it on sbcl for example by declaring (debug 0)
20:11:13
Bike
might vary in some complicated way based on other qualities
20:27:37
Bike
doesn't look like sbcl's introspection distinguishes between a lambda list of () and not having the lambda list
20:39:54
scymtym
Bike: if i remember correctly, SB-INTROSPECT:FUNCTION-LAMBDA-LIST was changed about two months ago to return a second value which indicates exactly that
20:40:09
Bike
ah. my version is older than that probably
3:02:08
beach
Good morning everyone!
4:36:26
susam
Good morning, everyone!
6:17:04
Lord_of_Life_
** NICK Lord_of_Life
Friday, 23rd of July 2021, 6:31:33 UTC