From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.bugs Subject: bug#70597: Problem in pcase-let? Date: Sun, 28 Apr 2024 12:01:18 +0200 Message-ID: <662e1e70.050a0220.3a3a2.45d1@mx.google.com> References: <662d23bf.050a0220.a4e2f.3f45@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5630"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70597@debbugs.gnu.org To: Marco Antoniotti Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 28 12:02:04 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 1s11MC-0001Ip-Mc for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Apr 2024 12:02:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s11Lu-0007tF-Qk; Sun, 28 Apr 2024 06:01:46 -0400 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 1s11Lr-0007si-NU for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 06:01:43 -0400 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 1s11Lq-0005F4-Td for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 06:01:43 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s11MA-0004YM-1X for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 06:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bruno Barbier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Apr 2024 10:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70597 X-GNU-PR-Package: emacs Original-Received: via spool by 70597-submit@debbugs.gnu.org id=B70597.171429850917490 (code B ref 70597); Sun, 28 Apr 2024 10:02:02 +0000 Original-Received: (at 70597) by debbugs.gnu.org; 28 Apr 2024 10:01:49 +0000 Original-Received: from localhost ([127.0.0.1]:50118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s11Lw-0004Y0-Sl for submit@debbugs.gnu.org; Sun, 28 Apr 2024 06:01:49 -0400 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:54678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s11Lu-0004Xu-Iy for 70597@debbugs.gnu.org; Sun, 28 Apr 2024 06:01:47 -0400 Original-Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-346406a5fb9so2980564f8f.1 for <70597@debbugs.gnu.org>; Sun, 28 Apr 2024 03:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714298481; x=1714903281; darn=debbugs.gnu.org; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=NqgYy7n35hLFK2RPUGMdsT+Q+6WOlej/WR4MH5f2Qvc=; b=jWHgh2l3bkmdA3UEfF2BZe4Zpk0cYfq5okFgBqyDBU3K8WD6euHPigLEYV5u0/FOE4 gK3Gbwkr38EZjiyBj06xYrQaZ1/bwse4C0PCoVKo2goYPCMl2x40eGnucSQvTC4i7Md/ fanPePwy+xWv8EDU3aP2/3c0iI4M4zMuHMHfF6Miz/BqIjetMFN33HdcJNNG/SNEKvbI 7DY5+4o3C5nfJ2SPavqUpBF1hcoMAuIYEigBYoG+fBFga16bDzMLbPIUW+R4jZ/Opxgy 33BmC6wP80uq2d/tRc98bbI7wp4+ahEixdlI8oyUFw6+byE0tR1+EgB0swoL+46ZfMVU Ogrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714298481; x=1714903281; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NqgYy7n35hLFK2RPUGMdsT+Q+6WOlej/WR4MH5f2Qvc=; b=cx+5mFz9tZ8M5axqfPgCWSUlC7yUlOVGCzYUrsWZ3h47XG8RTTiIiHgis1WmxtsXHk 8JIPwOuddOKoUBOkX1yCUODq9H0Mq0yWmDYUOkQ+itpNbjVQh3PhwdU5VzT7GNhwlrpJ 7cOBiGHJGbuoeX18Mye/8aVw7EJ3u7ZawEazfKWpjbUy7uM06Qb+ugU7/J0XkuMGiMu4 5ysUZLXJ1VNVFDO55vBxpsIse8qTta9eMeothbGO13DX1ACTXJwnBhx1pnNMaktcGZYx iQMhbfzz7LAg6LuliyFHTdioUhbtwz3ZI5leZhS+NZo2C/GG6VGwIwZl6uJL0LkcPOYd GZfA== X-Gm-Message-State: AOJu0Yz5wf+vrG9pGQyyLRqE+uPcqFeIXqiGjO9gbTe/NRo6w2zeI+22 wiQGOPEBUDHeA5quso4GfXi/q382KbwPnqKLt7n1rFQ5X0dfRDVy X-Google-Smtp-Source: AGHT+IG5oxvKz+9fNxTJfhcJG534hZdpJNfRryfjsVs5MA0b7iqtiG/6Lxpj2hUNDNMj89NFTf2gYA== X-Received: by 2002:a05:600c:450b:b0:41b:f022:8e69 with SMTP id t11-20020a05600c450b00b0041bf0228e69mr1966168wmo.19.1714298481039; Sun, 28 Apr 2024 03:01:21 -0700 (PDT) Original-Received: from keynux ([2a01:e0a:505:3460:1c18:688d:ece4:372e]) by smtp.gmail.com with ESMTPSA id h9-20020a05600c350900b0041c120dd345sm1968717wmq.21.2024.04.28.03.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 03:01:20 -0700 (PDT) Original-Received: by keynux (sSMTP sendmail emulation); Sun, 28 Apr 2024 12:01:19 +0200 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:284083 Archived-At: Hi Marco, Marco Antoniotti writes: > Hi Bruno > > Thank you for the reply, but sorry. IMHO it is a bug, At a minimum, > because pcase and pcase-let behave differently. > I may be inclined to accept the explanation that the documentation about > pcase-let allows for the behavior I find incorrect; that does not mean that > the behavior is what is normally expected. > > Pattern matchers do ... pattern matching. If you allow quasiquotes or > "incomplete specifications" (pick your preferred pattern matching > terminology), then you should honor the expectations; hence two symbols > that are not eq do not match. So, you would prefer for pcase-let to always signal an error if a pattern doesn't match. It makes sense. And it looks like the issue has already been raised: see bug#19670. (see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19670) > Also note that I do not have any star (*) operators in my examples. Thanks for mentionning this. I now see that you carefully crafted your HTML version, but, I only used the text version (that is less readable and contains plenty of stars). Sorry about the noise, explaining how to parse generated lightweight markup as elisp :) > Again, the machinery is there, cfr, the example below, which selects the > second clause. > > ELISP> > > *(pcase '(1 2 3 4) (`(1 2 ,x 5) (list 42 x)) (`(1 ,x 3 > 4) (list 666 x)))* > *(666 2)* I'm not sure it's that obvious: pcase doesn't really make a difference between match and no match: (eq (pcase 'b (`a t) (`b nil)) (pcase 'c (`a t) (`b nil))) ==> t If your request is really like bug#19670, further discussion should probably go there. All the best, Bruno