From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp? Date: Fri, 08 Sep 2023 20:39:28 -0400 Message-ID: References: Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8090"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ulm@gentoo.org, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 09 02:40:03 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qem15-0001or-1y for ged-emacs-devel@m.gmane-mx.org; Sat, 09 Sep 2023 02:40:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qem0s-0001kX-EE; Fri, 08 Sep 2023 20:39:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qem0X-0001X9-8D for emacs-devel@gnu.org; Fri, 08 Sep 2023 20:39:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qem0W-0006VF-UE; Fri, 08 Sep 2023 20:39:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=PkxfB+SBhji6mvBE/g8KLTO/AU3YW4SN2MpxPX0as1E=; b=lEr1Hl2WfTGe IQfgoi1xsM/yyrocrqRtB7F4EzDltliz8e2anApgpHwNYlYe7l4R6DA6SETZIuurtCW9o8RQjU3tA FGWnw0HWQBFCZdbg0XtVd6TGmVzc3goS8iSYfyjIsqcgAa8Vc9zKBF/kkPCx1hyL59s2Cw8KUcsMe NRW4b6pCb4hEeiC7tqM1paqn6DxDT1IkvpVuaLgY0QGVoPpELvOum6sy3yyA/4Rie4bWiKKSOnCrY kfa8scs5hH0XUIN1N4ct67Dj1qBIrWmBLu9JqYrFPEap2GLcMv+nfqYhf1uxLzohhCGOMEMZ3+Zrf ZWe4r23alVulWXlHla6B2Q==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1qem0W-0003t2-9J; Fri, 08 Sep 2023 20:39:28 -0400 In-Reply-To: (message from Alan Mackenzie on Wed, 6 Sep 2023 09:56:34 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310378 Archived-At: [[[ 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. ]]] > > Or, if you want to keep the condition about the availability of > > electric-indent-local-mode, how about keeping the code unchanged > > > (when (fboundp 'electric-indent-local-mode) ; Emacs 24.4 or later. > > > (electric-indent-local-mode (if c-electric-flag 1 0))) > > and inform the byte compiler that (fboundp 'electric-indent-local-mode) > > can be optimized based on the Emacs version? This way you won't need > > to change the source code, and we will get the ideal results. > I don't know how to do this. Early on in the thread, Ulrich Müller > suggested using 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? You spoke of "the additional complexity of the defmacro and defun macros". Could you please say concretely what that refers to, because I don't see it. > Originally, I wasn't really thinking about version numbers being the > prime use case, but it was easy to use them as an example to get the > discussion going. I think I misunderstood that point, but it's cleared up now. I am not arguing for or against switching between feature tests and version tests. The approach I am suggesting should work for both. -- 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)