GNU bug report logs - #52220
29.0.50; [PATCH] Declare struct predicates as pure functions

Previous Next

Package: emacs;

Reported by: Andrea Corallo <akrl <at> sdf.org>

Date: Wed, 1 Dec 2021 10:30:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Andrea Corallo <akrl <at> sdf.org>
Subject: bug#52220: closed (Re: bug#52220: 29.0.50; [PATCH] Declare struct
 predicates as pure functions)
Date: Wed, 01 Dec 2021 21:24:02 +0000
[Message part 1 (text/plain, inline)]
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 <at> debbugs.gnu.org.

-- 
52220: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=52220
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Andrea Corallo <akrl <at> sdf.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 52220-done <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure
 functions
Date: Wed, 01 Dec 2021 21:23:02 +0000
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Lars Ingebrigtsen [2021-12-01 21:32:43] wrote:
>> Andrea Corallo <akrl <at> sdf.org> 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

[Message part 3 (message/rfc822, inline)]
From: Andrea Corallo <akrl <at> sdf.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] Declare struct predicates as pure functions
Date: Wed, 01 Dec 2021 10:29:42 +0000
[Message part 4 (text/plain, inline)]
Hi all,

shouldn't we declare structure predicates as pure functions?

Proposed patch attached.

Thanks

  Andrea

[0001-lisp-emacs-lisp-cl-macs.el-cl-defstruct-Decl-struct-.patch (text/x-diff, inline)]
From 8382e2078295d6feb4abbe72cf671a61a84fc640 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <akrl <at> sdf.org>
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


This bug report was last modified 3 years and 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.