From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#52220: 29.0.50; [PATCH] Declare struct predicates as pure functions Date: Wed, 01 Dec 2021 21:16:01 +0000 Message-ID: References: <875ys8f4lw.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3881"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 52220@debbugs.gnu.org, Stefan Monnier To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 01 22:23:09 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1msX4H-0000pS-Lb for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Dec 2021 22:23:09 +0100 Original-Received: from localhost ([::1]:60512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msX4G-0001mq-O5 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Dec 2021 16:23:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msWyM-0004uu-Ax for bug-gnu-emacs@gnu.org; Wed, 01 Dec 2021 16:17:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msWyL-0001At-Uv for bug-gnu-emacs@gnu.org; Wed, 01 Dec 2021 16:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1msWyL-0004EX-Hb for bug-gnu-emacs@gnu.org; Wed, 01 Dec 2021 16:17:01 -0500 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 52220-submit@debbugs.gnu.org id=B52220.163839336716206 (code B ref 52220); Wed, 01 Dec 2021 21:17:01 +0000 Original-Received: (at 52220) by debbugs.gnu.org; 1 Dec 2021 21:16:07 +0000 Original-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 Original-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 Original-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 In-Reply-To: <875ys8f4lw.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 01 Dec 2021 21:32:43 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221241 Archived-At: 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