From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#68509: 30.0.50; pcase-dolist matches backquote pattern incorrectly Date: Mon, 19 Feb 2024 18:14:24 +0000 Message-ID: <8734to8gov.fsf@localhost> References: <87a5p5l3jm.fsf@localhost> <9bc2bd05-5fdb-9d5a-3d98-c344c7275027@gmail.com> <87sf2xjezi.fsf@localhost> <871q98hiqa.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14272"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jim Porter , 68509@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 19 19:12:02 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 1rc87Q-0003IN-TG for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Feb 2024 19:11:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc87H-0001L3-Ip; Mon, 19 Feb 2024 13:11:47 -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 1rc87B-0001KR-Fk for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 13:11: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 1rc87B-0003tt-7R for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 13:11:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rc87W-0005Xw-22 for bug-gnu-emacs@gnu.org; Mon, 19 Feb 2024 13:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Feb 2024 18:12:02 +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.170836627821268 (code B ref 68509); Mon, 19 Feb 2024 18:12:02 +0000 Original-Received: (at 68509) by debbugs.gnu.org; 19 Feb 2024 18:11:18 +0000 Original-Received: from localhost ([127.0.0.1]:43366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc86n-0005Wy-Sl for submit@debbugs.gnu.org; Mon, 19 Feb 2024 13:11:18 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:43813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc86j-0005Wg-SN for 68509@debbugs.gnu.org; Mon, 19 Feb 2024 13:11:16 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5F557240029 for <68509@debbugs.gnu.org>; Mon, 19 Feb 2024 19:10:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708366246; bh=2FQnKErhc8XFVS9Onp/2M6izh9AC9taH46Msa/sAONg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=KbeC5WV9ZQct9i/nzqK+Dw0OIaZb4v/R1e1HaZBQOfROWG7BLF9U7Vs6I2mI7hid2 Iw0FbyuF8UPrS1DhmpIPPdgaxPpK2yq2IU17sE7gTkNfMaMofZDzH39m4fRNdWaCvQ U15vGJmzM/Rzhn7QEeN2jdMFsqjU/IEwU75z5oEguqzxIcTdT52vMXPsQ0vnPN6hAn ZXuJQKRojGina/mHokI9Gfsj39M1eyLR967zs49Sg9/Ix1LAxH1ox3f1WBm49C0Sn7 cs2ep0et5cGVrnJO18aCxV3h1qts+yBhm65JjWa4uyLE1PCH4LmXGPpkydtyri/aco xNf3V64xVX9eg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TdrF14RYnz6tvb; Mon, 19 Feb 2024 19:10:44 +0100 (CET) In-Reply-To: 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:280285 Archived-At: 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. It is undefined what happens when LIST objects do not match PATTERN. So, any code relying upon iterating over non-matching elements is relying upon undefined, undocumented behaviour. Moreover, current implementation binds /partially matching/ list elements, which is even more fragile. From `pcase-let' docstring: a mismatch may signal an error or may go undetected, binding variables to arbitrary values, such as nil. What I suggest is to change what happens when PATTERN does not much more explicitly. In my patch, I proposed to skip such elements. An alternative could be throwing an error. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at