[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: |
Eli Zaretskii |
Subject: |
Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp? |
Date: |
Sun, 03 Sep 2023 07:42:13 +0300 |
> Date: Sat, 2 Sep 2023 19:43:29 +0000
> Cc: stefankangas@gmail.com, emacs-devel@gnu.org, mattiase@acm.org
> From: Alan Mackenzie <acm@muc.de>
>
> > > ++++
> > > +** There is now conditional compilation, based on the C language's #if.
> > > +To use this, see the new macro 'static-if'.
>
> > Same here. Here, it is actually worse: "based on C language's #if"
> > could be misinterpreted as meaning the implementation is based on #if
> > in some way. I would suggest the following text in NEWS:
>
> > ** New macro 'static-if' for conditional byte-compilation of code.
> > This macro hides a form from the byte-compiler based on a
> > compile-time condition. This is handy for avoiding byte-compilation
> > warnings about code that will never actually run under some
> > conditions.
>
> static-if actually works for interpreted compilation as well as byte
> compilation, so I've removed two "byte-"s from your text, leaving:
>
> +++
> ** New macro 'static-if' for conditional compilation of code.
> This macro hides a form from the compiler based on a compile-time
> condition. This is handy for avoiding byte-compilation warnings about
> code that will never actually run under some conditions.
What is "interpreted compilation" in Emacs? I'm aware of only two
compilers in Emacs: the byte compiler and the native compiler. So
when you talk about "the compiler" above, what does that allude to?
> I think it's now ready to commit, except ....
>
> I've had some private email which suggested that perhaps static-if
> should not include the condition-case which copes with an ancient eval
> from before lexical binding. I can see some merit in the argument
> (lexical binding happened in 24.1, I think), but on the other hand, that
> extreme backwards compatibility doesn't really cost us anything
> (static-if is just 13 lines of code).
>
> What do you think?
I don't think I understand the issue: it was discussed in private
email , and you didn't tell enough for me to understand and form an
opinion. What do you mean by "condition-case which copes with an
ancient eval from before lexical binding"?
Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?, Philip Kaludercic, 2023/09/02