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: Paul Pogonyshev
Subject: Re: Arbitrary function: find the number(s) of expected arguments
Date: Sat, 19 Mar 2016 13:26:47 +0100

Let's also consider it like this: `subr-arity' exists. But it has extremely narrow and non-obvious field of use. Compare:

    (subr-arity (symbol-function 'car))  =>  (1 . 1)
    (subr-arity (symbol-function 'caar))  =>  eval: Wrong type argument: subrp, #[257 "‰@@‡" [] 2 2409164]

And to make it even weirder (from `dash.el'):

    (defalias '-first-item 'car
      "Return the first item of LIST, or nil on an empty list.")

    (subr-arity (symbol-function '-first-item))  =>  (wrong-type-argument subrp car)

What if I use `subr-arity' for whatever reason in a case where it works, but in the next version Emacs moves the function from `.c' to `.el' and it ceases to be a built-in?

Paul

reply via email to

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