From unknown Sat Aug 16 13:46:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Dec 2021 10:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52220 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 52220@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16383545929816 (code B ref -1); Wed, 01 Dec 2021 10:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Dec 2021 10:29:52 +0000 Received: from localhost ([127.0.0.1]:43297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msMs4-0002YF-21 for submit@debbugs.gnu.org; Wed, 01 Dec 2021 05:29:52 -0500 Received: from lists.gnu.org ([209.51.188.17]:37776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msMs1-0002Y6-HV for submit@debbugs.gnu.org; Wed, 01 Dec 2021 05:29:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msMs1-0006bt-BL for bug-gnu-emacs@gnu.org; Wed, 01 Dec 2021 05:29:49 -0500 Received: from mx.sdf.org ([205.166.94.24]:53835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msMry-0000Rl-La for bug-gnu-emacs@gnu.org; Wed, 01 Dec 2021 05:29:49 -0500 Received: from ma.sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 1B1ATgWO016714 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Wed, 1 Dec 2021 10:29:42 GMT From: Andrea Corallo Date: Wed, 01 Dec 2021 10:29:42 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Hi all, shouldn't we declare structure predicates as pure functions? Proposed patch attached. Thanks Andrea --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-emacs-lisp-cl-macs.el-cl-defstruct-Decl-struct-.patch >From 8382e2078295d6feb4abbe72cf671a61a84fc640 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Wed, 1 Dec 2021 11:23:25 +0100 Subject: [PATCH] * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Decl struct predicates as pure --- lisp/emacs-lisp/cl-macs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 1852471bcb..9c9a778f04 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3050,7 +3050,7 @@ cl-defstruct `(,predicate cl-x)))) (when pred-form (push `(,defsym ,predicate (cl-x) - (declare (side-effect-free error-free)) + (declare (side-effect-free error-free) (pure t)) ,(if (eq (car pred-form) 'and) (append pred-form '(t)) `(and ,pred-form t))) -- 2.20.1 --=-=-=-- From unknown Sat Aug 16 13:46:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Dec 2021 20:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52220 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Andrea Corallo Cc: 52220@debbugs.gnu.org, Stefan Monnier Received: via spool by 52220-submit@debbugs.gnu.org id=B52220.163839078311824 (code B ref 52220); Wed, 01 Dec 2021 20:34:01 +0000 Received: (at 52220) by debbugs.gnu.org; 1 Dec 2021 20:33:03 +0000 Received: from localhost ([127.0.0.1]:45879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msWHm-00034e-EG for submit@debbugs.gnu.org; Wed, 01 Dec 2021 15:33:02 -0500 Received: from quimby.gnus.org ([95.216.78.240]:58566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msWHf-000343-UC for 52220@debbugs.gnu.org; Wed, 01 Dec 2021 15:33:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BsOFWVjyiJuHejq7H1Usim//Jc11mk3Lgr1AZ0Ssq/U=; b=Xg16tS3XhGqUnQwkcV66IsYX5h YUmug3fV1/bEsX6x55Jb7qyOyco20MeZ0+GMjgw7GqpuSvVYh3YyJeFW5DqZmRdGTg0H30x3ZQ07o GG4egke7W0PYicVS9fSieHMec3G2+5acg/M+OExSsTCBE5smkCfiiN/bc/phJg8F/iOo=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msWHT-0002Tm-Rc; Wed, 01 Dec 2021 21:32:48 +0100 From: Lars Ingebrigtsen References: X-Now-Playing: Fairport Convention's _Come All Ye (3)_: "Doctor of Physik" Date: Wed, 01 Dec 2021 21:32:43 +0100 In-Reply-To: (Andrea Corallo's message of "Wed, 01 Dec 2021 10:29:42 +0000") Message-ID: <875ys8f4lw.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Andrea Corallo writes: > shouldn't we declare structure predicates as pure functions? I think that's correct? The predicates take the struct as the argument, so they seem like pure functions to me. I've added Stefan to the CCs; perhaps there's some subtlety here I don't see. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Andrea Corallo writes: > shouldn't we declare structure predicates as pure functions? I think that's correct? The predicates take the struct as the argument, so they seem like pure functions to me. I've added Stefan to the CCs; perhaps there's some subtlety here I don't see. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Aug 16 13:46:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Dec 2021 21:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52220 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: 52220@debbugs.gnu.org, Andrea Corallo Received: via spool by 52220-submit@debbugs.gnu.org id=B52220.163839272115133 (code B ref 52220); Wed, 01 Dec 2021 21:06:01 +0000 Received: (at 52220) by debbugs.gnu.org; 1 Dec 2021 21:05:21 +0000 Received: from localhost ([127.0.0.1]:45914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msWn3-0003w1-21 for submit@debbugs.gnu.org; Wed, 01 Dec 2021 16:05:21 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msWn1-0003vo-Ar for 52220@debbugs.gnu.org; Wed, 01 Dec 2021 16:05:19 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6B429801A8; Wed, 1 Dec 2021 16:05:13 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1E3108037A; Wed, 1 Dec 2021 16:05:12 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1638392712; bh=H9WDb+aND/e13NIHTojdwbLSNnTbCHdX3HSfj6jyJb4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=d98XlSBsw8xbe57zZLqmU+tMw3l2A2JzkB7hPQxlosFIeXVstvw90odEoVRRmbRlO qS6aFPQ8h03560wwxHY0DWbp1IwQLGH917WBGG5lKcHs0dv8srzZei9KXQ7J2X1SLb F0Hp4+q7inxvhGMDOvGy35uxTlzyWNhL0FOFPo1lj8+g8Auu6yT0yvPiE9oSq5c7QN kygaIs5ybXM/vVvCyR65VkNtd7Pa91Sd/E704Ft8aB8xVRU802M1Bdr1+hhx86I+km EgraEL+emUsJK0jprxCcK2nGEuOjJVr8ShwsJhVsGS29mrlYOOyKYo8VPvmUIwEDS3 6kS5dcbHA/Edw== Received: from pastel (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E5C991204B7; Wed, 1 Dec 2021 16:05:11 -0500 (EST) From: Stefan Monnier Message-ID: References: <875ys8f4lw.fsf@gnus.org> Date: Wed, 01 Dec 2021 16:05:11 -0500 In-Reply-To: <875ys8f4lw.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 01 Dec 2021 21:32:43 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.090 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Lars Ingebrigtsen [2021-12-01 21:32:43] wrote: > Andrea Corallo writes: >> shouldn't we declare structure predicates as pure functions? > I think that's correct? Sounds right, yes. Stefan From unknown Sat Aug 16 13:46:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Dec 2021 21:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52220 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: 52220@debbugs.gnu.org, Stefan Monnier Received: via spool by 52220-submit@debbugs.gnu.org id=B52220.163839336716206 (code B ref 52220); Wed, 01 Dec 2021 21:17:01 +0000 Received: (at 52220) by debbugs.gnu.org; 1 Dec 2021 21:16:07 +0000 Received: from localhost ([127.0.0.1]:45918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msWxT-0004DK-2l for submit@debbugs.gnu.org; Wed, 01 Dec 2021 16:16:07 -0500 Received: from mx.sdf.org ([205.166.94.24]:55176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msWxO-0004Ci-Gc for 52220@debbugs.gnu.org; Wed, 01 Dec 2021 16:16:06 -0500 Received: from ma.sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 1B1LG187007819 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Wed, 1 Dec 2021 21:16:01 GMT From: Andrea Corallo References: <875ys8f4lw.fsf@gnus.org> Date: Wed, 01 Dec 2021 21:16:01 +0000 In-Reply-To: <875ys8f4lw.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 01 Dec 2021 21:32:43 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > Andrea Corallo writes: > >> shouldn't we declare structure predicates as pure functions? > > I think that's correct? The predicates take the struct as the argument, > so they seem like pure functions to me. I've added Stefan to the CCs; > perhaps there's some subtlety here I don't see. Yes we have all conventional predicates as pure, the only difference is that here the result of the predicate depends also on the global state. IOW redefining a structure could change the result of a predicate, but my guess is that we don't want to be robust against that (structs in general AFAIK are not robust against run-time redefinition). Andrea From unknown Sat Aug 16 13:46:38 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Andrea Corallo Subject: bug#52220: closed (Re: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions) Message-ID: References: X-Gnu-PR-Message: they-closed 52220 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 52220@debbugs.gnu.org Date: Wed, 01 Dec 2021 21:24:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1638393842-16982-1" This is a multi-part message in MIME format... ------------=_1638393842-16982-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #52220: 29.0.50; [PATCH] Declare struct predicates as pure functions which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 52220@debbugs.gnu.org. --=20 52220: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D52220 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1638393842-16982-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 52220-done) by debbugs.gnu.org; 1 Dec 2021 21:23:08 +0000 Received: from localhost ([127.0.0.1]:45928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msX4G-0004Oi-2s for submit@debbugs.gnu.org; Wed, 01 Dec 2021 16:23:08 -0500 Received: from mx.sdf.org ([205.166.94.24]:52907) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msX4D-0004OV-35 for 52220-done@debbugs.gnu.org; Wed, 01 Dec 2021 16:23:07 -0500 Received: from ma.sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 1B1LN2Nt012727 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Wed, 1 Dec 2021 21:23:02 GMT From: Andrea Corallo To: Lars Ingebrigtsen Subject: Re: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions References: <875ys8f4lw.fsf@gnus.org> Date: Wed, 01 Dec 2021 21:23:02 +0000 In-Reply-To: (Stefan Monnier via's message of "Wed, 01 Dec 2021 16:05:11 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 52220-done Cc: 52220-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > Lars Ingebrigtsen [2021-12-01 21:32:43] wrote: >> Andrea Corallo writes: >>> shouldn't we declare structure predicates as pure functions? >> I think that's correct? > > Sounds right, yes. > > > Stefan Right, installed as c35c86a353, closing. Thanks Andrea ------------=_1638393842-16982-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 Dec 2021 10:29:52 +0000 Received: from localhost ([127.0.0.1]:43297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msMs4-0002YF-21 for submit@debbugs.gnu.org; Wed, 01 Dec 2021 05:29:52 -0500 Received: from lists.gnu.org ([209.51.188.17]:37776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msMs1-0002Y6-HV for submit@debbugs.gnu.org; Wed, 01 Dec 2021 05:29:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msMs1-0006bt-BL for bug-gnu-emacs@gnu.org; Wed, 01 Dec 2021 05:29:49 -0500 Received: from mx.sdf.org ([205.166.94.24]:53835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msMry-0000Rl-La for bug-gnu-emacs@gnu.org; Wed, 01 Dec 2021 05:29:49 -0500 Received: from ma.sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 1B1ATgWO016714 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Wed, 1 Dec 2021 10:29:42 GMT From: Andrea Corallo To: bug-gnu-emacs@gnu.org Subject: 29.0.50; [PATCH] Declare struct predicates as pure functions Date: Wed, 01 Dec 2021 10:29:42 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Hi all, shouldn't we declare structure predicates as pure functions? Proposed patch attached. Thanks Andrea --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-emacs-lisp-cl-macs.el-cl-defstruct-Decl-struct-.patch >From 8382e2078295d6feb4abbe72cf671a61a84fc640 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Wed, 1 Dec 2021 11:23:25 +0100 Subject: [PATCH] * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Decl struct predicates as pure --- lisp/emacs-lisp/cl-macs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 1852471bcb..9c9a778f04 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3050,7 +3050,7 @@ cl-defstruct `(,predicate cl-x)))) (when pred-form (push `(,defsym ,predicate (cl-x) - (declare (side-effect-free error-free)) + (declare (side-effect-free error-free) (pure t)) ,(if (eq (car pred-form) 'and) (append pred-form '(t)) `(and ,pred-form t))) -- 2.20.1 --=-=-=-- ------------=_1638393842-16982-1--