From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp? Date: Sat, 09 Sep 2023 10:32:37 +0000 Message-ID: <87cyyr7i2i.fsf@localhost> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5047"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Mackenzie , ulm@gentoo.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 09 12:33:52 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 1qevHk-00013r-BP for ged-emacs-devel@m.gmane-mx.org; Sat, 09 Sep 2023 12:33:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qevFl-00029R-5w; Sat, 09 Sep 2023 06:31:49 -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 1qevFc-0001y6-MQ for emacs-devel@gnu.org; Sat, 09 Sep 2023 06:31:46 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qevFa-0005LO-66 for emacs-devel@gnu.org; Sat, 09 Sep 2023 06:31:40 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7830C240104 for ; Sat, 9 Sep 2023 12:31:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1694255496; bh=hgNjcAHUJOfJ6UG2rc+NtW+zoAlblDzcEPqp9QGCxxE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=RLUg1m6sld49GEu4InY9Z9griQmbjuqSQZjLauBpcZif/84Je7Vy3v0+IEOmJ0M17 yOafbdEmnxVQ7OYOO0HwsibEI+GqNcBogZSO7U5aP2Ek3d0eDKmumMnOB8+1PRhg3r YJ+2m7b815QMjlj8mcgyjDipYdkki5AUiPOmLuhk84KHq1dGstv7yS/Nr0CxYdk4ZT 1fr83Q9HRTdMV1Ipxe85b6hTUMDQtFRv7En3W6aRFZEamc3C0yrhk+Kb+5WrUvtxsJ Wme7uRJp0VqfMexWF1SpV949aq9cpcUUsbBR0b3IIsqLdkAUA639gfCSjcYyMGi9/D I8ofotXtt+cTw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RjTmR6M49z9rxW; Sat, 9 Sep 2023 12:31:35 +0200 (CEST) In-Reply-To: Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:310396 Archived-At: Richard Stallman writes: > 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? Because there are cases when `fboundp' should be checked at runtime. For example, some parts of Org use `fboundp' to check if certain third-party optional dependencies are loaded. If `fboundp' is resolved at compile time, such checks will be broken. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at