[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: |
Ulrich Mueller |
Subject: |
Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp? |
Date: |
Tue, 05 Sep 2023 10:14:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>>>> On Mon, 28 Aug 2023, Alan Mackenzie wrote:
>> Sorry, I should have been clearer. The full construct would look like
>> this:
>> (when (eval-when-compile (< emacs-major-version 24))
>> (defadvice .....))
> Ah! So the eval-when-compile gets compiled to a constant nil or t, and
> the byte compiler optimises the test of this out, either compiling or
> not compiling the (defadvice .....). Thanks! I hadn't been aware of
> that little detail.
>> So only the test would be evaluated at compile time, the defadvice
>> itself would be compiled normally (or not, if the test fails).
I've just tested with current master. Byte-compiling this:
(static-if (> emacs-major-version 24)
(message "new emacs")
(message "old emacs"))
and this:
(if (eval-when-compile (> emacs-major-version 24))
(message "new emacs")
(message "old emacs"))
results in identical byte code.
> However, when evaluating the containing defun/defmacro rather than byte
> compiling it, the irritating warning message will appear with the e-w-c
> strategem, but not with hash-if. ;-)
Sorry, I cannot reproduce this problem. Could you give an example?
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, (continued)
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Alan Mackenzie, 2023/09/06
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Richard Stallman, 2023/09/08
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Ihor Radchenko, 2023/09/09
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Richard Stallman, 2023/09/09
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Ihor Radchenko, 2023/09/10
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Richard Stallman, 2023/09/13
- Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Ihor Radchenko, 2023/09/20
Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?,
Ulrich Mueller <=