[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Subrp returns nil for function objects and symbols? Is this a bug or
From: |
Stephen Berman |
Subject: |
Re: Subrp returns nil for function objects and symbols? Is this a bug or me misunderstanding it? |
Date: |
Tue, 13 Aug 2024 13:08:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Tue, 13 Aug 2024 09:22:01 +0000 arthur miller <arthur.miller@live.com> wrote:
> (subrp 'car) => nil
> (subrp #'car) => nil
> (subrp '+) => nil
>
> (subrp (symbol-function 'car)) => t
>
> According to the doc, subrp should tell me if "OBJECT" is a built-in
> function or not. I would expect "car" to be that, since car is implemented
> in the C source (in data.c).
>
> I also get the same behavior for compiled-function-p.
>
> Is it not valid to pass a symbol and function objects to those two
> functions? Can we in that case clarify in the doc string expected
> value(s) for OBJECT?
At least it's documented in the Elisp manual (info "(elisp) What Is a
Function"):
Unlike ‘functionp’, the next functions do _not_ treat a symbol as its
function definition.
-- Function: subrp object
This function returns ‘t’ if OBJECT is a built-in function (i.e., a
Lisp primitive).
(subrp 'message) ; ‘message’ is a symbol,
⇒ nil ; not a subr object.
(subrp (symbol-function 'message))
⇒ t
Steve Berman