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: Alan Mackenzie
Subject: Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?
Date: Wed, 30 Aug 2023 10:31:40 +0000

Hello, Stefan.

On Tue, Aug 29, 2023 at 22:09:25 +0200, Stefan Kangas wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > What do people think about this?

> I have two questions:

> 1. Would it be hard to make the byte-compiler not warn in the
> situation you describe?

(That situation being where an obsolete function/variable is tested for,
and is used or not used according to the result of the test.)  It would
not be too hard, and the scheme I'm proposing (with help from Philip K.)
is one way of doing this.

I'm sure there are other possible ways, too.

> 2. Isn't something like this enough to silence the byte-compiler?

>     (defalias 'foo-defadvice
>       (if (< emacs-major-version 24)
>           'defadvice
>         (lambda () (message "foo"))))
>     (foo-defadvice)

It may be, but it's clumsy.  We would need such an alias for _each_
function/variable which has been declared obsolete.  In my proposed
mechanism, by contrast, one would just need to replace an `if' form by a
`hash-if'.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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