all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrea Corallo <akrl@sdf.org>
To: 52220@debbugs.gnu.org
Subject: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions
Date: Wed, 01 Dec 2021 10:29:42 +0000	[thread overview]
Message-ID: <xjfczmgzkh5.fsf@ma.sdf.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Hi all,

shouldn't we declare structure predicates as pure functions?

Proposed patch attached.

Thanks

  Andrea


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-emacs-lisp-cl-macs.el-cl-defstruct-Decl-struct-.patch --]
[-- Type: text/x-diff, Size: 911 bytes --]

From 8382e2078295d6feb4abbe72cf671a61a84fc640 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <akrl@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


             reply	other threads:[~2021-12-01 10:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 10:29 Andrea Corallo [this message]
2021-12-01 20:32 ` bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions Lars Ingebrigtsen
2021-12-01 21:05   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-01 21:23     ` Andrea Corallo
2021-12-01 21:16   ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xjfczmgzkh5.fsf@ma.sdf.org \
    --to=akrl@sdf.org \
    --cc=52220@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.