[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should `indirect-function' be preferred over `fboundp'?
From: |
Eli Zaretskii |
Subject: |
Re: Should `indirect-function' be preferred over `fboundp'? |
Date: |
Thu, 20 Jul 2023 10:42:27 +0300 |
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Thu, 20 Jul 2023 07:08:48 +0000
>
> (defalias 'yant/foo 'yant/bar)
> (fboundp 'yant/foo) ; => t
> (funcall 'yant/foo) ; => ERROR: Symbol function definition is void: yant/foo
>
> In contrast, `indirect-function' does a better job determining whether a
> given symbol can be called as a function:
>
> (indirect-function 'yant/foo) ; => nil
>
> Is it something widely known?
The ELisp manual says:
-- Function: fboundp symbol
This function returns ‘t’ if the symbol has an object in its
function cell, ‘nil’ otherwise. It does not check that the object
is a legitimate function.
So this is at least documented.