From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68509: 30.0.50; pcase-dolist matches backquote pattern incorrectly Date: Mon, 19 Feb 2024 21:41:43 -0500 Message-ID: References: <87a5p5l3jm.fsf@localhost> <9bc2bd05-5fdb-9d5a-3d98-c344c7275027@gmail.com> <87sf2xjezi.fsf@localhost> <871q98hiqa.fsf@localhost> <8734to8gov.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16740"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Jim Porter , 68509@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 20 03:43:11 2024 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 1rcG6A-00048g-SY for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Feb 2024 03:43:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcG5j-0006cI-Ch; Mon, 19 Feb 2024 21:42:43 -0500 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 1rcG5h-0006Vu-1f for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 21:42:41 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcG5g-0006j0-QK for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 21:42:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcG61-0005Tr-UG for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 21:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Feb 2024 02:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68509 X-GNU-PR-Package: emacs Original-Received: via spool by 68509-submit@debbugs.gnu.org id=B68509.170839693521009 (code B ref 68509); Tue, 20 Feb 2024 02:43:01 +0000 Original-Received: (at 68509) by debbugs.gnu.org; 20 Feb 2024 02:42:15 +0000 Original-Received: from localhost ([127.0.0.1]:43962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcG5G-0005Sl-Ik for submit@debbugs.gnu.org; Mon, 19 Feb 2024 21:42:15 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcG5E-0005SW-EI for 68509@debbugs.gnu.org; Mon, 19 Feb 2024 21:42:13 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 43C5E442739; Mon, 19 Feb 2024 21:41:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1708396903; bh=G+NueyJXDE25snu//F9695I7hPNIAFOHe8lxTMafGdU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=P+5qLUxX5WGjcApLCIpZMDlWHEUdBjZ08kftpdtvy5PIYIX3q/tWfqdBrd30CSnFg GRgGEXNQ7ck3DWDxCXNuXx4o/OvFQSSe5c9vgnJfKu42nAFkVdH2kG+G85PrZLRg5n 0GbL7MO0FHn/zmWl9l8yik59X+l/uxPgiLACdlW4Xlcqe+JJkRun3eBa/jEYb7bDB1 NexN8Y3oKm+RC0skkM5DVc194g2HvWY43jklAhC5JOyZL2Ei+QJ4VU586pMHZdm13F huncnEiDqHnQoBzwhHo0DKgAIB3kVKSkzSMF1OpzmPgQgZmhFe3Q34zI9gP67PLCTn vS/Agp9oAsbwA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D1F50442711; Mon, 19 Feb 2024 21:41:43 -0500 (EST) Original-Received: from pastel (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AC5E11202AB; Mon, 19 Feb 2024 21:41:43 -0500 (EST) In-Reply-To: <8734to8gov.fsf@localhost> (Ihor Radchenko's message of "Mon, 19 Feb 2024 18:14:24 +0000") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280301 Archived-At: Ihor Radchenko [2024-02-19 18:14:24] wrote: > Stefan Monnier writes: > >>> * lisp/emacs-lisp/pcase.el (pcase-dolist): Use `pcase' rather than >>> `pcase-let*' to match the list elements. Update the docstring, >> >> That changes its behavior. It *will* break code. >> This is basically not the same macro any more. Instead of being a macro >> that iterates over all the elements of the list, it becomes a macro >> which iterates only over the matching elements. > > Currently, the docstring states: > > PATTERN should be a `pcase' pattern describing the structure of > LIST elements, and LIST is a list of objects that match PATTERN, > i.e. have a structure that is compatible with PATTERN. The doc for `pcase-let` is a bit more precise: Each EXP should match (i.e. be of compatible structure) to its respective PATTERN; a mismatch may signal an error or may go undetected, binding variables to arbitrary values, such as nil. > In my patch, I proposed to skip such elements. > An alternative could be throwing an error. As I said, what you propose is a *different* construct. Maybe we should add some extra option/keyword to `pcase-dolist` to indicate what to do with elements that don't match (such as signaling an error, a warning, silently skipping it, ...). Similar issues affect `pcase-let`, of course. Stefan