emacs-devel
[Top][All Lists]
Advanced

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

Re: Should `indirect-function' be preferred over `fboundp'?


From: Michael Heerdegen
Subject: Re: Should `indirect-function' be preferred over `fboundp'?
Date: Fri, 21 Jul 2023 03:08:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Ihor Radchenko <yantar92@posteo.net> writes:

> (I can see that `fboundp' is used all over Emacs git sources, while
> `indirect-function' is rarely used)

I'm actually not that surprised.  I guess, most often code using an
`fboundp' test wants to test whether a function has already been defined
(e.g. by another package), or is available in the current Emacs version.

An alias is a definition.  In most cases the definition as an alias is
intentional.  If an alias points to an undefined function, I guess that,
in the majority of cases, this hints at some kind of problem so it's
better to have an error rather than to circumvent the problem by using
`indirect-function'.

Are aliases to undefined functions something to expect often?  The
compiler warns in the case when the DEFINITION is the name of an unknown
function.  It should be the responsibility of the alias creating code to
ensure that the alias is not broken.


Michael.




reply via email to

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