From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71503: 30.0.50; pcase-lambda (with "and" and "guard") does not work as expected Date: Sun, 04 Aug 2024 10:58:00 +0300 Message-ID: <86r0b4sos7.fsf@gnu.org> References: <87r0d2lfjd.fsf@posteo.de> <87h6dvud8u.fsf@posteo.net> <86tthlidap.fsf@gnu.org> <86frsn55t3.fsf@gnu.org> <865xt0e6wc.fsf@gnu.org> <87ikx0mk4c.fsf@posteo.net> <87sew2ly1n.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1795"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mekeor@posteo.de, philipk@posteo.net, 71503@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 04 09:59:03 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 1saW8t-0000JN-Jh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Aug 2024 09:59:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saW8Z-0006o9-A8; Sun, 04 Aug 2024 03:58:43 -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 1saW8X-0006nl-Nw for bug-gnu-emacs@gnu.org; Sun, 04 Aug 2024 03:58:41 -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 1saW8X-0003yH-Cg for bug-gnu-emacs@gnu.org; Sun, 04 Aug 2024 03:58:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=6Dl63JBcBQmgqGy/NAfx4/hjXJEN5IZJlwGZrzADpJM=; b=NQ6wETkXUmGjgvifPH/JdGhTecI4Yu2EaxCWttfyAFU2QBuQkX1ZdP9XL8BCysZsnUYc6e/kuxq6WB364rEH4kW9ohBMevU7wyhU7WRlKGUKqEcnZ57jDhsA9NsU8UhPqwe3XKFPChIXaGvgZY6+FWHbemLmUUCg7f41cOJwT/X3Kw68y/Unmiek+WGjWf86WVbmHpv1/ItInMrSLDAmt981gcX7UHpTCyiGj9OV2bt+jCXYBX6UQCMkgMeQYELM6yTjMgfzOc3vOsAaeqmqoUbCX7nXzJIJh9j+2ABgMmaSxJcMpRzq+m6v0W7pw+nKVl+f2E01dr/ewkp04nwvQQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saW8s-0005Bg-50 for bug-gnu-emacs@gnu.org; Sun, 04 Aug 2024 03:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2024 07:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71503 X-GNU-PR-Package: emacs Original-Received: via spool by 71503-submit@debbugs.gnu.org id=B71503.172275831219846 (code B ref 71503); Sun, 04 Aug 2024 07:59:02 +0000 Original-Received: (at 71503) by debbugs.gnu.org; 4 Aug 2024 07:58:32 +0000 Original-Received: from localhost ([127.0.0.1]:55399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saW8O-00059z-Ag for submit@debbugs.gnu.org; Sun, 04 Aug 2024 03:58:32 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saW8L-00059I-FM for 71503@debbugs.gnu.org; Sun, 04 Aug 2024 03:58:30 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1saW7u-0003ty-Uw; Sun, 04 Aug 2024 03:58:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6Dl63JBcBQmgqGy/NAfx4/hjXJEN5IZJlwGZrzADpJM=; b=S3wbokdXcHk6 0kFcVvNRNgju3YNXsTht4qt87Cs5OCRJznWBqA27Skrujig61qnC2u/3TzajYhck8RoxfvumzG+Gt rFVRWHUDyXLDBLuT2mgCaWlkMLFujFkI/KUgBkU/lViefesnYGSp4Aw/noylj8sPjRMJbeh1BRC+G IW8Z4/BOCCxtNPWq+zDnuLF7cJbgwMqvVUGZfZqDop8z5sGBzYnIc7XfYBFNtBWVqRENVxER7zvox 94deooXdX0JY7sR2aY+6KLer9ZLqPsbEZd8SnM57rBXYj4VJtRAnxMGBuGWUG+PjiOHO3e2C8jZ6j mvE85dYrDAXU7m+bcQXmRA==; In-Reply-To: (message from Stefan Monnier on Sun, 21 Jul 2024 09:51:04 -0400) 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:289722 Archived-At: Ping! can we please make progress with this issue, one way or another? > From: Stefan Monnier > Cc: Eli Zaretskii , mekeor@posteo.de, 71503@debbugs.gnu.org > Date: Sun, 21 Jul 2024 09:51:04 -0400 > > > Another confusing behaviour that we should document is that in > > > > (let ((a nil)) > > (funcall > > (pcase-lambda (a (and (guard a) b)) > > (list a b)) > > 1 2)) > > > > I would expect that the (guard a) would use the nil binding from the > > `let' form, but instead it is ignored and b is bound to 2. I am not > > sure if this is related to the "destructing" point or not. > > It most definitely is: the `guard` controls here whether the pattern > matches or not, but since it's a destructuring match `pcase` takes it > for granted that the pattern does match, so the guard is ignored. > > What might be more confusing is the scoping, e.g.: > > (macroexpand '(pcase-lambda ((and (guard a) b) a) (FOO))) > => > #'(lambda (arg0 a) (pcase-let* (((and (guard a) b) arg0)) (FOO))) > > so the `a` in the guard refers to the argument that follows rather than > to a surrounding `a` binding. > > > Stefan > >