emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Arbitrary function: find the number(s) of expected arguments


From: Eli Zaretskii
Subject: Re: Arbitrary function: find the number(s) of expected arguments
Date: Sat, 19 Mar 2016 16:08:23 +0200

> From: Michael Heerdegen <address@hidden>
> Date: Sat, 19 Mar 2016 14:54:10 +0100
> 
> Eli Zaretskii <address@hidden> writes:
> 
> > Patches to add func-arity to Emacs are welcome.
> 
> Question: Is this a reasonable way to go?  Will `func-arity' be a good
> solution for the issues we discussed here?

Do you have a better solution to suggest?  If so, let's hear it.

> For example, if
> 
> (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).

> Would that be useful?

Why wouldn't it be?

> What would it return for adviced functions?  An advice can change the
> arity of a function.  Most do not, but most advices have an &rest args
> signature.  Any function can be adviced.

If the solution handles this complication, then it will return an
accurate result.  If not, it will be a known limitation.

> My question is if it is a good idea to invite users to rely on something
> like `func-arity'.

You could ask the same about subr-arity, couldn't you?  And yet we do
have it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]