From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lynn Winebarger Newsgroups: gmane.emacs.devel Subject: Re: Why have a #if .... #else .... #endif construct in Emacs Lisp, when we could make the existing code DTRT unchanged? Date: Tue, 5 Sep 2023 07:26:01 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000de422d06049ae4e2" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21954"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Mackenzie , ulm@gentoo.org, emacs-devel To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 05 13:27:31 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 1qdUDT-0005Zv-1b for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Sep 2023 13:27:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdUCT-00072K-VP; Tue, 05 Sep 2023 07:26:30 -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 1qdUCT-00072B-0N for emacs-devel@gnu.org; Tue, 05 Sep 2023 07:26:29 -0400 Original-Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdUCF-00061n-7w; Tue, 05 Sep 2023 07:26:28 -0400 Original-Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-56a55c0f8b1so1152314a12.0; Tue, 05 Sep 2023 04:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693913171; x=1694517971; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7SiHh/XpY67pFO2cDFckzhNmmzVuRY7JEepDRrTLc7w=; b=VQ/jredI2iveeaL6Nz7QDTicipAjmgi77fOUfce5nXqdKsFouzkKmRZ5Gbr1Taqtq9 HZrSXwotDE+CPkRciAyEO7txQsX+naymy08LX3Mf0JKlEYv1hIXDHGwyyCpP6jjOVjUi Ey288hIpHWDul/bWyvNnrQ0yn2KMMLorSVv/8VpK3sBJx4ImAnikVvbJnDtCvYmW8a3C 5KlFLCVENsDci9YMT2Uj0fv9OsrtHVbybUGCxrJ30yOiLsoBBZjRz5ZWVmaduAoJJSiL Ebt0VvJlChLpYKthkqDEqaXgvfAA+kP3hSmcFsuaavlvsWpr6RxIR3uHw+QRePeaDQh0 mJew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693913171; x=1694517971; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7SiHh/XpY67pFO2cDFckzhNmmzVuRY7JEepDRrTLc7w=; b=Gp9e8/oPO5VuA7UaqTW4jc5UywhmriSMh8wH8/Y6A2EcAy5euRvPwVu2ElnFEqsfN4 ILfE37fyYEizPp02SjTbVllhQmd2etslCScVTH5mE8cOjoM/5NPZyX2z8yUghfijcLUY srh5U0Pv/Gz3QBcpywkcYmdsDya1cO1MCkNj1Qd89Kc0oR6+UofQlPMhWTTq+ZhaNsQb 8GbhPFXAlsPThNng972j+wtdnvk4tZoDHeB/x2auCanVuQr7PO3wRUfOil1yuJdnPkmu OgW33JfgN4l38kWCF+/hrZqIhH9MWfNOphmyFPFUHDptiHCeQZ0df4Rvl44hwrU9iWL+ 8Y3Q== X-Gm-Message-State: AOJu0YwHAA1lXksixaPMCl7s3H4ewEJWhx2cForddDHVByQuYCGk7Sov DkLw3/JEAh/1bFtoiZMnW0YzBLO0bm7B29wPehPSRJoP X-Google-Smtp-Source: AGHT+IH6USNC/3ox2v9+qOwIs+V/ckDinq+1LLs82Uqyawve7hdRKphWop+/8u4XxleLWsgc0eWZV+JV/mMoUasoqbA= X-Received: by 2002:a17:90a:d38d:b0:268:ac99:4bb4 with SMTP id q13-20020a17090ad38d00b00268ac994bb4mr9433127pju.46.1693913171507; Tue, 05 Sep 2023 04:26:11 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=owinebar@gmail.com; helo=mail-pg1-x52d.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:310126 Archived-At: --000000000000de422d06049ae4e2 Content-Type: text/plain; charset="UTF-8" On Mon, Sep 4, 2023, 8:30 PM Richard Stallman wrote: > [[[ 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. ]]] > > > How about making the byte compiler recognize the construct > > > (if (< emacs-major-version NUMBER) ...) > > > and do this optimization on it? > > People seem not to have considered this seriously, but I have not seen > any serious discussion of a drawback. What flaw or drawback do people > see in it? It should optimize the existing the existing code with no > change at all. Isn't that just perfect? > Since byte-compiled files are not versioned, emacs-major-version is not really a constant, so constant-folding isn't correct. For example, loading a file in version 29 that was byte-compiled by version 28 (or earlier) may not be the same as byte-compiling the file with version 29. Lynn --000000000000de422d06049ae4e2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Sep 4, 2023, 8:30 PM Richard Stallman <rms@gnu.org> wrote:
[[[ To any NSA and FBI agents reading my email: please consider= =C2=A0 =C2=A0 ]]]
[[[ whether defending the US Constitution against all enemies,=C2=A0 =C2=A0= =C2=A0]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]<= br>
=C2=A0 > How about making the byte compiler recognize the construct

=C2=A0 >=C2=A0 (if (< emacs-major-version NUMBER) ...)

=C2=A0 > and do this optimization on it?

People seem not to have considered this seriously, but I have not seen
any serious discussion of a drawback.=C2=A0 What flaw or drawback do people=
see in it?=C2=A0 It should optimize the existing the existing code with no<= br> change at all.=C2=A0 Isn't that just perfect?


Since byte-compiled files are not versioned, emacs-major-version is not r= eally a constant, so constant-folding isn't correct.
For example, loading a file in version 29 that was byte-compiled by ve= rsion 28 (or earlier) may not be the same as byte-compiling the file with v= ersion 29.

Lynn


--000000000000de422d06049ae4e2--