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: Richard Stallman
Subject: Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?
Date: Wed, 30 Aug 2023 22:07:04 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > >     (when (eval-when-compile (< emacs-major-version 24))
  > >       (defadvice .....))

  > 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.  ;-)

How about making the byte compiler recognize the construct
 
 (if (< emacs-major-version NUMBER) ...)

and do this optimization on it?

I think that will DTRT when compiled and when interpreted,
and it won't require changes in the code of the programs that use it.

That will handle `when' and `unless', since they expand into `if'.

It may be necessary to implement this in two places, one for inside of
function bodies and one for top level (outside of function
definitions).  But the code for this should be so short that having
two is hardly much loss.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





reply via email to

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