emacs-devel
[Top][All Lists]
Advanced

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

Re: Why shouldn't we have a #if .... #else .... #endif construct in Emac


From: Ihor Radchenko
Subject: Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?
Date: Sat, 09 Sep 2023 10:32:37 +0000

Richard Stallman <rms@gnu.org> writes:

> We can make the byte compiler recognize any pattern of code
> and treat it specially.  It has two sets of special
> patterns: those for inside function definitions (being compiled in
> the strict sense of the word), and those for top level.
>
> A pattern for top level could recognize patterns like
>
>    (if (fboundp ...) ...)  and  (if (not (fboundp ...)) ...)
>
> and do whatever the proposed `static-if' function would have done.
>
> Why not?

Because there are cases when `fboundp' should be checked at runtime.
For example, some parts of Org use `fboundp' to check if certain
third-party optional dependencies are loaded. If `fboundp' is resolved
at compile time, such checks will be broken.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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