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: Sat, 24 Feb 2024 13:28:50 +0000 Message-ID: <87sf1ivvn1.fsf@localhost> References: <87a5p5l3jm.fsf@localhost> <9bc2bd05-5fdb-9d5a-3d98-c344c7275027@gmail.com> <87sf2xjezi.fsf@localhost> <871q98hiqa.fsf@localhost> <8734to8gov.fsf@localhost> <87o7cbz21n.fsf@localhost> <87jzmzyxlv.fsf@localhost> <87y1berrh6.fsf@localhost> <87bk87i8dc.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="15665"; 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 Sat Feb 24 14:41:14 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 1rdsHC-0003tv-QD for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Feb 2024 14:41:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsGj-0004v9-3M; Sat, 24 Feb 2024 08:40:45 -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 1rdsGc-0004uu-RI for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2024 08:40:39 -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 1rdsGc-0007sJ-D3 for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2024 08:40:38 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdsGz-0007j4-SA for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2024 08:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Feb 2024 13:41: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.170878201829581 (code B ref 68509); Sat, 24 Feb 2024 13:41:01 +0000 Original-Received: (at 68509) by debbugs.gnu.org; 24 Feb 2024 13:40:18 +0000 Original-Received: from localhost ([127.0.0.1]:57020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdsGG-0007gv-6C for submit@debbugs.gnu.org; Sat, 24 Feb 2024 08:40:18 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:56527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rds24-00073I-Fh for 68509@debbugs.gnu.org; Sat, 24 Feb 2024 08:25:38 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id CE1A5240027 for <68509@debbugs.gnu.org>; Sat, 24 Feb 2024 14:25:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1708781105; bh=EjGEgGzp0SmOVry9FxH3DsmTRlnGqILeTkIAlRU0VAM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=gqo+sqrzDQPphfn3SMXZm2ZcoHNDFqgy3d9BCaAdQNjAt7F8bvr2k7XTQoOMOjwDK ddVtUGdEZsIR9f7YWQQ0Kg8+uLdUOU/OTqt+pnMZGy5zdZgAjwO4+QusOOdRy9xaBc XJzKvoJ7DQDKgHb19baJj7rCwPQE6lwCS7zbqplzk3/oe+3XBF36kCOTaH+LPSBP1b YtBo/o5hVQQS0XPV3R5vlZGDYqEDtPKEyPnFAUM+JGGHaKyx4xLk/bSbtOlAgORxa1 iht1Fx04RdqB1pX/JssVpl0W/OKPzbt6HC7PvjU8bVxJGyrNLQl7463CIr3MSvz03R fz67ixkxaUkKg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Thng45VX5z9rxB; Sat, 24 Feb 2024 14:25:04 +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:280547 Archived-At: Stefan Monnier writes: >>> +For example, the above pattern will result in... >> >> This is confusing. In particular, "for example" implies that other >> situations are possible. It is unclear how the reader will know when >> "variables bound to arbitrary values" happen, when variables are bound >> to nil, and when an error is signaled. > > This part of the doc is generic, so it can't guarantee anything: the > behavior depends on the actual pattern and the way that pattern is defined. > In order to intuit what will happen, the reader needs to guess which > primitives are used to extract the info from value (e.g. `car/cdr/nth` > for cons cells, `aref` for arrays, ...). I do not think that "guess" is what we should ever put into docs. Because implementation details may change and any kind of guess may then go wrong. >> I would re-structure the paragraph, explicitly listing the possible >> outcomes when the PATTERN does not match VALUE and stating that any >> other non-matching PATTERN will lead to undefined outcome. > > Could you try to do that? > [ I've found back-and-forth modifications of docs give better results > than single-sided writing. ] I could, but I am not sure which non-matching outcomes we should document and which we want to leave undefined. I still don't have a clear picture about the differences between normal pcase and destructuring pcase. Especially for non-trivial patterns. For example, (pcase-let (((and `(,a ,b ,c) (guard (eq a 'foo))) '(bar a))) (list a b c)) ; =>'(bar a nil) is extremely confusing. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at