[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arbitrary function: find the number(s) of expected arguments
From: |
Michael Heerdegen |
Subject: |
Re: Arbitrary function: find the number(s) of expected arguments |
Date: |
Sat, 19 Mar 2016 16:57:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
> > > > (defun f (a b) (list a b))
> > > >
> > > > (defalias 'g (apply-partially #'f 1))
> > > >
> > > > what would (func-arity 'g) return?
> > >
> > > Ideally, it should return (1 . 1).
> >
> > This signature can be interpreted as "accepts any number of arguments",
> > whereby it doesn't. The condition-case solution with the wrong number
> > of args handler at least also catches this case.
>
> But Emacs itself clearly _knows_ that only one argument is acceptable.
> So a function that replicates the steps made by the Lisp interpreter
> to arrive at this conclusion will be able to reach the same
> conclusion. So I don't see any insoluble problems here.
My examples where just special examples. Generally, there is no clear
border or distinction between some kind of "wrapper" around a function
(like apply-partially or advice-add create), or a function that calls
another function in it's body.
So what should `function-arity' return? The actual arity of the
function? An arity that takes information about some known kinds of
wrappers into account?
No matter how you do it: the result will never give you a clear answer.
Even if the user understands what he is doing: if `function-arity' can't
answer the question whether a certain number of arguments is allowed, it
is of not much value.
Michael.
- Arbitrary function: find the number(s) of expected arguments, Paul Pogonyshev, 2016/03/15
- Re: Arbitrary function: find the number(s) of expected arguments, Davis Herring, 2016/03/15
- Re: Arbitrary function: find the number(s) of expected arguments, Paul Pogonyshev, 2016/03/16
- Re: Arbitrary function: find the number(s) of expected arguments, Paul Pogonyshev, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Paul Pogonyshev, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Michael Heerdegen, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Michael Heerdegen, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments,
Michael Heerdegen <=
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Michael Heerdegen, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Michael Heerdegen, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Philipp Stephani, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Michael Heerdegen, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Philipp Stephani, 2016/03/19
- Re: Arbitrary function: find the number(s) of expected arguments, Eli Zaretskii, 2016/03/19