From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jun 2015 20:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 20784@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Reply-To: bruce.connor.am@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.14339676232957 (code B ref -1); Wed, 10 Jun 2015 20:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Jun 2015 20:20:23 +0000 Received: from localhost ([127.0.0.1]:47511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z2mU2-0000lc-KV for submit@debbugs.gnu.org; Wed, 10 Jun 2015 16:20:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53344) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z2mU0-0000lR-NO for submit@debbugs.gnu.org; Wed, 10 Jun 2015 16:20:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2mTz-0007PU-MM for submit@debbugs.gnu.org; Wed, 10 Jun 2015 16:20:20 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2mTz-0007PB-K8 for submit@debbugs.gnu.org; Wed, 10 Jun 2015 16:20:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2mTy-0005db-GR for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2015 16:20:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2mTw-0007M3-VZ for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2015 16:20:18 -0400 Received: from mail-la0-x241.google.com ([2a00:1450:4010:c03::241]:32940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2mTw-0007Lk-Nz for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2015 16:20:16 -0400 Received: by lamq1 with SMTP id q1so5858003lam.0 for ; Wed, 10 Jun 2015 13:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:date:message-id:subject:from:to :content-type; bh=4y5av9PBCSb3ItFzKbDUsjiQ0wxfNoKsW7RoLrfzsfQ=; b=pooGwhhwxrxmLtHryickoscll2388lQ3AqaRmDvCRf6mVE8daEmJQ8Bz/cL6EacPM7 33kMHnE9kYXCSgt0DPN2kmvy0B9tq9xSSx3GTqWkwYhqEuoqAD+z2kR9A/FJq5BSaXf5 a+KzdkG0mimuG2bWZvcHhuHs2mUHKWv3y4kYxjFLOxjMYiErRc6Kho4pyGyrGUQWfSfs SkOa7BOIyHeXNfuooKQAX01C42SyQxnRLhu/dZE4bBcedtjq+Ln3zqFW6MQYyAJQW+El AgkckCEpHEBSOf7+cbX9p21HYfOYTDMM/n4lD6WQgkuqtpJ6wFv9gBsScQ+xI4wc+2nJ HQDw== MIME-Version: 1.0 X-Received: by 10.152.29.34 with SMTP id g2mr5920536lah.73.1433967615262; Wed, 10 Jun 2015 13:20:15 -0700 (PDT) Received: by 10.25.214.133 with HTTP; Wed, 10 Jun 2015 13:20:15 -0700 (PDT) Date: Wed, 10 Jun 2015 21:20:15 +0100 X-Google-Sender-Auth: D3uKicO0JliSE8gtep9gtrgx9vU Message-ID: From: Artur Malabarba Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) In pcase's docstirng, the second line of pcase patterns says: SELFQUOTING matches itself. This includes keywords, numbers, and strings. However, that doesn't apply to t and nil, instead, they are covered by the SYMBOL clause. I've always thought of t and nil as self-quoting, but if that's not the case, I think the docstring should explicitly state: SELFQUOTING matches itself. This includes keywords, numbers, and strings (but not t or nil). From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jun 2015 03:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Artur Malabarba Cc: 20784@debbugs.gnu.org Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143399205817245 (code B ref 20784); Thu, 11 Jun 2015 03:08:02 +0000 Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 03:07:38 +0000 Received: from localhost ([127.0.0.1]:50023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z2sqA-0004U5-Jg for submit@debbugs.gnu.org; Wed, 10 Jun 2015 23:07:38 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:60828) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z2sq8-0004Tx-Ga for 20784@debbugs.gnu.org; Wed, 10 Jun 2015 23:07:37 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t5B37Zce021532; Wed, 10 Jun 2015 23:07:35 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 1507B6614A; Wed, 10 Jun 2015 23:07:35 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 10 Jun 2015 23:07:35 -0400 In-Reply-To: (Artur Malabarba's message of "Wed, 10 Jun 2015 21:20:15 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5333=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5333> : inlines <3181> : streams <1453442> : uri <1955534> X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > SELFQUOTING matches itself. This includes keywords, numbers, and strings. > However, that doesn't apply to t and nil, instead, they are covered by > the SYMBOL clause. I think the problem is in the wording: t and nil are neither keywords, nor numbers, nor strings, which is why they aren't treated as SELFQUOTING. IOW the wording shouldn't say "including" but make it clear that these are the (currently) only accepted selfquoting entities. E.g. vectors (and friends) aren't considered as SELFQUOTING by pcase either. Stefan From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jun 2015 12:25:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 20784@debbugs.gnu.org Reply-To: bruce.connor.am@gmail.com Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.14340254959818 (code B ref 20784); Thu, 11 Jun 2015 12:25:03 +0000 Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 12:24:55 +0000 Received: from localhost ([127.0.0.1]:50425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z31XT-0002YI-9M for submit@debbugs.gnu.org; Thu, 11 Jun 2015 08:24:55 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:33562) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z31XQ-0002Y3-Dm for 20784@debbugs.gnu.org; Thu, 11 Jun 2015 08:24:53 -0400 Received: by lbcue7 with SMTP id ue7so3247030lbc.0 for <20784@debbugs.gnu.org>; Thu, 11 Jun 2015 05:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=KdphjzT9fCWdwg9D1PORlE4454+zKUKcNiT3UkDxFVI=; b=WMro9knL6joVmxpew6W4ZQrOQtD2a9czvYyQTNrX6aar9TdX/1SzQJNzhHjc8Lxfsj mStJ8RGol8OobC5WbwTTEvX8siiIWgG9bkSSccc45z2iFlpokwhBTbBT2awGHg8zK/NW L7iyAuvY0cV2v82qTBG6kwgicAAUWNgTqj8jOqDxjiVMAgcBc2gy5SDQKn7HCd8IUZJ8 gbvCNHacs5KmGNOwk5RVcwAnGD7LcDeSNYkc7yEQTwVOuzwHNs7BDQ86JvWZUznG9R9t tNGlCjOoMq9Zd5TYtpcYCI2zYi+jumin21GpCfi/nNL1Yx7aJUUmdqSvKiCg7ui5p4YP Wx5g== MIME-Version: 1.0 X-Received: by 10.152.203.233 with SMTP id kt9mr9615440lac.21.1434025486448; Thu, 11 Jun 2015 05:24:46 -0700 (PDT) Received: by 10.25.214.133 with HTTP; Thu, 11 Jun 2015 05:24:46 -0700 (PDT) In-Reply-To: References: Date: Thu, 11 Jun 2015 13:24:46 +0100 X-Google-Sender-Auth: KJn2Tll7JgYzBOLQ3HeMdbek9Ac Message-ID: From: Artur Malabarba Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) I've also had reports that (pcase something ('nil 1)) complains of invalid pattern in 24.5, while it works fine for me in 25.0. Is there a proper way to match nil? If I just use nil, I get errors on 25, but using 'nil gives errors on 24.5. From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jun 2015 12:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Artur Malabarba Cc: Stefan Monnier , 20784@debbugs.gnu.org Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143402603810687 (code B ref 20784); Thu, 11 Jun 2015 12:34:01 +0000 Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 12:33:58 +0000 Received: from localhost ([127.0.0.1]:50440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z31gD-0002mI-Gs for submit@debbugs.gnu.org; Thu, 11 Jun 2015 08:33:57 -0400 Received: from mout.web.de ([212.227.17.11]:51452) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z31gA-0002m3-CW for 20784@debbugs.gnu.org; Thu, 11 Jun 2015 08:33:55 -0400 Received: from drachen.dragon ([90.187.158.178]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LfzxX-1ZN1gB44S3-00pbUb; Thu, 11 Jun 2015 14:33:45 +0200 From: Michael Heerdegen References: Date: Thu, 11 Jun 2015 14:33:37 +0200 In-Reply-To: (Artur Malabarba's message of "Thu, 11 Jun 2015 13:24:46 +0100") Message-ID: <874mmev2zi.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:Cm3yp/yqkxzBy0c7KbeOXl5ZzwvRB+YrR23vhEuaU27TB6K5xja zzsCV2A2bVwUZ/rCL+s8AglxpwgroenECN/ER8jas5F8zhZtWFSIzG3K4R12KfEFkptVwak 8HDLgTt6MDC0PtqvbGG3OH2CMbiP//i+lw/YgMeXWW3bI3Y6NwbOtzFDA1/ievoCqUSFirZ SdqJKvLQO67LexIu6Rcgg== X-UI-Out-Filterresults: notjunk:1; X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Artur Malabarba writes: > I've also had reports that (pcase something ('nil 1)) complains of > invalid pattern in 24.5, while it works fine for me in 25.0. > Is there a proper way to match nil? If I just use nil, I get errors on > 25, but using 'nil gives errors on 24.5. AFAICT, `nil is the correct way. Michael. From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jun 2015 13:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 20784@debbugs.gnu.org, Artur Malabarba Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143402873014571 (code B ref 20784); Thu, 11 Jun 2015 13:19:01 +0000 Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 13:18:50 +0000 Received: from localhost ([127.0.0.1]:50466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z32Nd-0003mw-Rg for submit@debbugs.gnu.org; Thu, 11 Jun 2015 09:18:50 -0400 Received: from mout.web.de ([212.227.17.11]:57994) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z32Nb-0003mi-Bo for 20784@debbugs.gnu.org; Thu, 11 Jun 2015 09:18:48 -0400 Received: from drachen.dragon ([90.187.158.178]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LbrZ2-1ZUR691vme-00jIrr; Thu, 11 Jun 2015 15:18:39 +0200 From: Michael Heerdegen References: Date: Thu, 11 Jun 2015 15:18:28 +0200 In-Reply-To: (Stefan Monnier's message of "Wed, 10 Jun 2015 23:07:35 -0400") Message-ID: <87r3pitmcb.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:Rc2fpT9wV/tHz4bEmXGf05xjCJgL2H8ddumlHvk5z41XWmuzqIJ lhflZY0n6VLg78G50SPhdFOpO4KQcBvX0JLP+wpkgE26FU/+9vfugLsAGbGNfBPCybE1Cpv rAbSonR9B/AqblMT+AfLiHQ6HHoO0uUSNSTCDX27ISRs/lOjJXFpCtakFLNw+Gg+Y8LxFUQ u+JT9hbUEL6pQiY2XXdRg== X-UI-Out-Filterresults: notjunk:1; X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Stefan Monnier writes: > > SELFQUOTING matches itself. This includes keywords, numbers, and > > strings. > > > However, that doesn't apply to t and nil, instead, they are covered by > > the SYMBOL clause. > > I think the problem is in the wording: t and nil are neither keywords, > nor numbers, nor strings, which is why they aren't treated as > SELFQUOTING. IOW the wording shouldn't say "including" but make it > clear that these are the (currently) only accepted selfquoting entities. > E.g. vectors (and friends) aren't considered as SELFQUOTING by > pcase either. Just an opinion from another user: I think the semantic of SELFQUOTING is so non-obvious and non-intuitive that it's not worth it to confuse people who learn pcase with it, for the sake that it's more or less the same as the pattern 'VAL, or a subset from it: SELFQUOTING applies to some atomic expressions that eval to themselves, to others not. SELFQUOTING "matches itself", which again depends on the kind of thing. It doesn't always mean `eq' (as the wording "itself" suggests), because strings don't just match only themselves but any other `equal' string. But it also doesn't mean "equal" because in the case of numbers, comparison is done with `eq': (pcase 5.0 (5 5) (5.0 5.0)) => 5.0 The case of t is especially non-obvious; it's neither treated as SELFQUOTING nor as SYMBOL, but as a pattern matching anything. While `t' meaning "applies always" makes sense in `cond', because there the right sides are interpreted as booleans, it can be IMHO confusing to beginners in pcase because it could make you think that pcase is about booleans, but it's about pattern matching. I found myself trying stuff like (pcase expr ((and x (symbolp x)) (symbol-name x))), maybe having the `t' pattern in mind? And `nil' OTOH is different again. It is not interpreted as "applies never", but raises an error when used ("applies never" could make sense when the code is generated by a macro). I think I would consider to trivialize the semantic, merging the SELFQUOTING and 'VAL case. I would remove the SELFQUOTING thing as it is now. I would keep the semantic of 'VAL as it is now, as it is perfectly clear. To substitute the SELFQUOTING thing, we could allow something like ATOM - which can be any atomic expression that is not a symbol that can be bound - and make it simply an abbreviation for 'ATOM. (FWIW, unifying `ATOM and 'ATOM would IMHO also be worth it; currently 'ATOM is compared always with `equal', whereby `ATOM is compared with `equal' for strings and `eq' else. You can always use guard when you want a different comparison predicate.) I know that would all would break existing code, but it would make pcase easier to understand and to learn. Just my two cents. Regards, Michael. From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jun 2015 15:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Artur Malabarba Cc: 20784@debbugs.gnu.org Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143403623425860 (code B ref 20784); Thu, 11 Jun 2015 15:24:02 +0000 Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 15:23:54 +0000 Received: from localhost ([127.0.0.1]:50938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z34Kf-0006j2-P8 for submit@debbugs.gnu.org; Thu, 11 Jun 2015 11:23:54 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:49170) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z34Kd-0006it-Bi for 20784@debbugs.gnu.org; Thu, 11 Jun 2015 11:23:51 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id CE2839C153; Thu, 11 Jun 2015 11:23:50 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id C264A1E5B94; Thu, 11 Jun 2015 11:23:27 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 96810B416C; Thu, 11 Jun 2015 11:23:27 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Thu, 11 Jun 2015 11:23:27 -0400 In-Reply-To: (Artur Malabarba's message of "Thu, 11 Jun 2015 13:24:46 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > I've also had reports that (pcase something ('nil 1)) complains of > invalid pattern in 24.5, while it works fine for me in 25.0. IIRC the "quote" pattern is new in Emacs-25. You have to use backquote patterns instead in Emacs<25. Stefan From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jun 2015 16:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Heerdegen Cc: 20784@debbugs.gnu.org, Artur Malabarba Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143403977430964 (code B ref 20784); Thu, 11 Jun 2015 16:23:01 +0000 Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 16:22:54 +0000 Received: from localhost ([127.0.0.1]:50959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z35Fm-00083M-4X for submit@debbugs.gnu.org; Thu, 11 Jun 2015 12:22:54 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:35562) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z35Fk-00083E-0H for 20784@debbugs.gnu.org; Thu, 11 Jun 2015 12:22:52 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 2204D11C045; Thu, 11 Jun 2015 12:22:51 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 5EC891E5B94; Thu, 11 Jun 2015 12:22:28 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 418A7B416C; Thu, 11 Jun 2015 12:22:28 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87r3pitmcb.fsf@web.de> Date: Thu, 11 Jun 2015 12:22:28 -0400 In-Reply-To: <87r3pitmcb.fsf@web.de> (Michael Heerdegen's message of "Thu, 11 Jun 2015 15:18:28 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > (pcase 5.0 > (5 5) > (5.0 5.0)) => 5.0 Hmm... indeed, I used "numbers" (and `numberp') in pcase, where I really meant "integers". That's a bug. The above code should (IMO) signal an error indicating that floats aren't accepted as patterns. The intention is that SELFQUOTING should always be matched with an `equal' semantics (`eq' is used on integers and keywords as a plain optimization which should not affect the semantics). E.g. using `eq' on strings makes string patterns simply unusable. > The case of t is especially non-obvious; it's neither treated as Yes, it was a mistake to accept t to mean the same as `_'. Not sure if it's too late to fix it, but t should not be accepted as a special pattern. We could handle it like nil (i.e. pretend it's a normal variable which then signals an error when we try to let-bind it) or emit a warning. > never", but raises an error when used ("applies never" could make > sense when the code is generated by a macro). We currently don't have a special "fail" pattern which simply never matches. Of course, you can make one up (e.g. (guard nil)). I think making nil such a pattern would probably lead to more errors/confusion than anything, since it's extremely rare to need such a pattern. > I think I would consider to trivialize the semantic, merging the > SELFQUOTING and 'VAL case. We could drop the SELFQUOTING case, but I added it because it lets you reduce the clutter of quoting, which tends to be fairly high in pcase patterns. > semantic of 'VAL as it is now, as it is perfectly clear. To substitute > the SELFQUOTING thing, we could allow something like ATOM - which can be > any atomic expression that is not a symbol that can be bound - and make > it simply an abbreviation for 'ATOM. That's pretty much what SELFQUOTING is. IF you think renaming it to ATOM would help, then we could do that. > (FWIW, unifying `ATOM and 'ATOM would IMHO also be worth it; They should behave identically, yes. > currently 'ATOM is compared always with > `equal', whereby `ATOM is compared with `equal' for strings and `eq' > else. As explained the use of `eq' is supposed to be a pure optimization with no semantics effect. The fact that we accept floats and compare them with `eq' is a plain bug. Stefan From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jun 2015 16:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Heerdegen Cc: 20784@debbugs.gnu.org, Artur Malabarba Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143404047932009 (code B ref 20784); Thu, 11 Jun 2015 16:35:02 +0000 Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 16:34:39 +0000 Received: from localhost ([127.0.0.1]:50964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z35R7-0008K8-66 for submit@debbugs.gnu.org; Thu, 11 Jun 2015 12:34:38 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:54983) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z35R5-0008Jz-24 for 20784@debbugs.gnu.org; Thu, 11 Jun 2015 12:34:35 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id AA3C085FA5; Thu, 11 Jun 2015 12:34:34 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id AD7C11E5B94; Thu, 11 Jun 2015 12:34:10 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 7F581B416C; Thu, 11 Jun 2015 12:34:10 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87r3pitmcb.fsf@web.de> Date: Thu, 11 Jun 2015 12:34:10 -0400 In-Reply-To: <87r3pitmcb.fsf@web.de> (Michael Heerdegen's message of "Thu, 11 Jun 2015 15:18:28 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) How 'bout the following patch? Stefan * lisp/emacs-lisp/pcase.el (pcase): Reword the SELFQUOTING case. (pcase--split-pred, pcase--self-quoting-p): Restrict selfquoting numbers to integers. (pcase--u1): Deprecate t patterns. Reject nil as an invalid pattern. diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index ab82b7e..a6994a6 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -112,11 +112,12 @@ CASES is a list of elements of the form (PATTERN CODE...). Patterns can take the following forms: _ matches anything. - SELFQUOTING matches itself. This includes keywords, numbers, and strings. SYMBOL matches anything and binds it to SYMBOL. (or PAT...) matches if any of the patterns matches. (and PAT...) matches if all the patterns match. 'VAL matches if the object is `equal' to VAL + SELFQUOTING is a shorthand for 'SELFQUOTING. + SELFQUOTING can be a keyword, an integer, or a string. (pred FUN) matches if FUN applied to the object returns non-nil. (guard BOOLEXP) matches if BOOLEXP evaluates to non-nil. (let PAT EXP) matches if EXP matches PAT. @@ -620,7 +621,7 @@ MATCH is the pattern that needs to be matched, of the form: ((and (eq 'pred (car upat)) (eq 'quote (car-safe pat)) (symbolp (cadr upat)) - (or (symbolp (cadr pat)) (stringp (cadr pat)) (numberp (cadr pat))) + (or (symbolp (cadr pat)) (stringp (cadr pat)) (integerp (cadr pat))) (get (cadr upat) 'side-effect-free) (ignore-errors (setq test (list (funcall (cadr upat) (cadr pat)))))) @@ -638,7 +639,7 @@ MATCH is the pattern that needs to be matched, of the form: res)) (defun pcase--self-quoting-p (upat) - (or (keywordp upat) (numberp upat) (stringp upat))) + (or (keywordp upat) (integerp upat) (stringp upat))) (defun pcase--app-subst-match (match sym fun nsym) (cond @@ -770,7 +771,12 @@ Otherwise, it defers to REST which is a list of branches of the form (sym (car cdrpopmatches)) (upat (cdr cdrpopmatches))) (cond - ((memq upat '(t _)) (pcase--u1 matches code vars rest)) + ((memq upat '(t _)) + (let ((code (pcase--u1 matches code vars rest))) + (if (eq upat '_) code + (macroexp--warn-and-return + "Pattern t is deprecated. Use `_' instead" + code)))) ((eq upat 'pcase--dontcare) :pcase--dontcare) ((memq (car-safe upat) '(guard pred)) (if (eq (car upat) 'pred) (pcase--mark-used sym)) @@ -784,7 +790,7 @@ Otherwise, it defers to REST which is a list of branches of the form (pcase--eval (cadr upat) vars)) (pcase--u1 matches code vars then-rest) (pcase--u else-rest)))) - ((symbolp upat) + ((and (symbolp upat) upat) (pcase--mark-used sym) (if (not (assq upat vars)) (pcase--u1 matches code (cons (cons upat sym) vars) rest) @@ -854,7 +860,7 @@ Otherwise, it defers to REST which is a list of branches of the form (pcase--u rest)) vars (list `((and . ,matches) ,code . ,vars)))) - (t (error "Unknown internal pattern `%S'" upat))))) + (t (error "Unknown pattern `%S'" upat))))) (t (error "Incorrect MATCH %S" (car matches))))) (def-edebug-spec From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jun 2015 17:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 20784@debbugs.gnu.org, Artur Malabarba Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143413028728141 (code B ref 20784); Fri, 12 Jun 2015 17:32:02 +0000 Received: (at 20784) by debbugs.gnu.org; 12 Jun 2015 17:31:27 +0000 Received: from localhost ([127.0.0.1]:52041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3Sne-0007Jo-3g for submit@debbugs.gnu.org; Fri, 12 Jun 2015 13:31:26 -0400 Received: from mout.web.de ([212.227.17.12]:59248) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3Snb-0007Ja-HT for 20784@debbugs.gnu.org; Fri, 12 Jun 2015 13:31:24 -0400 Received: from drachen.dragon ([90.187.252.31]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MXpZD-1YZ1D10ZC3-00WpUO; Fri, 12 Jun 2015 19:31:16 +0200 From: Michael Heerdegen References: <87r3pitmcb.fsf@web.de> Date: Fri, 12 Jun 2015 19:31:10 +0200 In-Reply-To: (Stefan Monnier's message of "Thu, 11 Jun 2015 12:22:28 -0400") Message-ID: <87ioasdeap.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:dpGxQxejmIuRAu+a8J1sLfxMIJDtedYOkI0sYCQMx1rS1muTvKX g1rYi/exxc+QkLPwgovZRtQ7wLUZBikZt/8R7N/SKJFk8rm6C+evCoEynIQbzjCXlUMaQCS 2iKBq+8e5+t0zf9Qo+nIpk94Sg5Vmng/qDWA60LY9rriMOv7tvUPsrqnjIPnbpjRX2xgaRl GxAVjZk1gWZTwJT+VQmEg== X-UI-Out-Filterresults: notjunk:1;V01:K0:Wt952T2Axag=:Pw0MNzevtLQmDvEcySNjv3 NeHTYIUycpuyDqLo6VS4Jr1BMLf/0ygJpeqVWZfyJY0WsfYa7EDPQGP1UZbsZdwvWkoLSQhvC 1pir6u9EGtTJ2yb7U4WVEJcctTa9D3n/6WtT9hdMMqeAkRHbP0tz8J1v3Qoow+SKgefzD5ujk NmYzANH7QF84ZPdLvYZ7fbFM8qM9D2o0AJ6Ldf3hA/mOenWcGkbrEW4NbpbNJ9Dz8JLFLVLBc Q0qaDJeFRz6dGV1wURzyR4oifo98e7CEbBEKjwDJkrYG3TLLtotWFFr3yylrjeaI+n/Aod96e RZeHEDKy+u5eBXwKFA7EbSNZ0b3BB0HJN1wEKBVEYfBtKz9jxV2vaqXga05lddSD7kaFO6gZS yu7it0mVAZlg6/tEpxefnogPU3d5feYL+E05HkPDGuQOcaS0T6X/7ShOcsu64e0Jc52czxPae GmAULA9Rjb4ppuOn9BLWyOtG+xMU4bWzQIhs2EZSgFT8y2rmdF/4cfWnVXIxZz8ftboNLqIgM QJUM/3gHXOchxcWwycxPZci6/ekfjYxxb1lt+GGu1JxDxLWR5UKSmT9qtjKzzQj3wVrUrNebH AWXQAPXMg8pHOcesjZJMp7qlY+gUXHnroRI733JqdhJAm5Qf7TKMRkfRSbGZYpY7mayBMuRRB 3NA6GXGdiwYBTkUJQSpBE+0WB4tOZ+bcP0hs0rV3RyQwm/tSljW4zPDckK/kLUROUCWo= X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Stefan Monnier writes: > We currently don't have a special "fail" pattern which simply never > matches. Of course, you can make one up (e.g. (guard nil)). (or) would also do it, but raises (error "Please avoid it") (BTW (or _) raises that error, too). Why are those (error "Please avoid it") calls useful? > I think making nil such a pattern would probably lead to more > errors/confusion than anything, since it's extremely rare to need such > a pattern. Agreed. > That's pretty much what SELFQUOTING is. IF you think renaming it to > ATOM would help, then we could do that. I would prefer that over SELFQUOTING because SELFQUOTING is a shorthand for 'SELFQUOTING. sounds like a tautology. > As explained the use of `eq' is supposed to be a pure optimization with > no semantics effect. I see. Then I guess it would make sense to merge these two lines in the ` doc? STRING matches if the object is =E2=80=98equal=E2=80=99 to= STRING. ATOM matches if the object is =E2=80=98eq=E2=80=99 to AT= OM. into ATOM matches if the object is =E2=80=98equal=E2=80=99 to= ATOM. Regards, Michael. From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jun 2015 17:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 20784@debbugs.gnu.org, Artur Malabarba Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143413061628727 (code B ref 20784); Fri, 12 Jun 2015 17:37:01 +0000 Received: (at 20784) by debbugs.gnu.org; 12 Jun 2015 17:36:56 +0000 Received: from localhost ([127.0.0.1]:52051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3Ssx-0007TG-DC for submit@debbugs.gnu.org; Fri, 12 Jun 2015 13:36:55 -0400 Received: from mout.web.de ([212.227.15.14]:52187) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3Ssu-0007T0-Ls for 20784@debbugs.gnu.org; Fri, 12 Jun 2015 13:36:53 -0400 Received: from drachen.dragon ([90.187.252.31]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0LtWsu-1ZDbnl0EmC-010rzb; Fri, 12 Jun 2015 19:36:45 +0200 From: Michael Heerdegen References: <87r3pitmcb.fsf@web.de> Date: Fri, 12 Jun 2015 19:36:03 +0200 In-Reply-To: (Stefan Monnier's message of "Thu, 11 Jun 2015 12:34:10 -0400") Message-ID: <87eglgde2k.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:3s9QNkfu/DCHM+Rha9anO73YZvYBk+Oc81dzvAqdU+MyuNzTIWw U2iNfwP2SqtCuKs2aULSnmiP3jWVUu8vO4yBnU/M2E2zGUfjX5Xbf0ipYDiCeF+jWW4YYg3 Ot+dYHwJSU0CiC0eSJoapmMpi0rlzJAaTO5KWiOGVmVsfsLMNgyLfU+m5ypbDtzWcws//m5 q9Sc1XJ/WMveeeQlaOl6Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:BT5s91hEaZw=:ynm/i3stp/32DLzvLBQYBl b6Oc/y3XZuvypY9nsxx4XF6dPCiGJDYoYRgUmBtb25xMCXwR/CXE3G11edKGDXQ9UUXwrleuE ZZiA/ttGCjZwOQ8zbJvhwA7RwCnEgVqM4s1LFogV+lufOd0F78eTDDjr9bPcRgZkgZ+iUaX9y 0m7CTztbXMiawqsuXkFp0s3FZT2DWEsKKAoAjpBwcERotfYjFz6yboB3jLe+MbuAn7YaFpoy/ KZj3bD+hJa/6k3EzTSoc/8osRcLQC2hKTOOlOQQP9MOuEf5q1J2q5a282cLFjGKRboDPipO63 E6HQ1zHuUax4rqus2YDb1nn085xN37ybIALZLS/QqVC9PlIc2ez2bawWp2Ky/7A/m3xmUr9KA OTINYwD3SKaY/KSCjCgMFcdtbx0sNU0WHGVgmOXCeuhic6jvEgrTn1LEyUnu+ggUnuzoANXzF CUIn0svKuoMi/sF7yH3VXDAc4PgvVuFS+26DPuktsi6pIRhJCL/rH2PW3edvQvt+0PUwCj6Qa 92G3ueLF1g1suuj7b+YSw3eajA4I60bKxQFgOHi69QJj6sJOP1EBEmGz0WthRC7Vbl+7M1v1N m6bpnj1nNN6xolilKVEBzmyyQuCTfCR+u9jBfVsEsyW4oAjWlntTi+G7Z0hbet1zr7qS2iDFr zb5tnGYdI+OetVNdOJXEBZcRhyajQRO66wv6aVqsMiFpolwcQLxZpPuV5wI+BHj/OzeU= X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Stefan Monnier writes: > How 'bout the following patch? > > * lisp/emacs-lisp/pcase.el (pcase): Reword the SELFQUOTING case. > (pcase--split-pred, pcase--self-quoting-p): Restrict selfquoting > numbers to integers. > (pcase--u1): Deprecate t patterns. Reject nil as an invalid pattern. Thanks, that looks good to me. Comments in my message above. Michael. From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Jun 2015 16:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Heerdegen Cc: 20784@debbugs.gnu.org, Artur Malabarba Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143447306327221 (code B ref 20784); Tue, 16 Jun 2015 16:45:02 +0000 Received: (at 20784) by debbugs.gnu.org; 16 Jun 2015 16:44:23 +0000 Received: from localhost ([127.0.0.1]:56048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4tyI-00074z-7U for submit@debbugs.gnu.org; Tue, 16 Jun 2015 12:44:22 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:33829) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4tyF-00074q-Ea for 20784@debbugs.gnu.org; Tue, 16 Jun 2015 12:44:20 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id D813C9C148; Tue, 16 Jun 2015 12:44:18 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id E4FA51E5B8D; Tue, 16 Jun 2015 12:43:55 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id BC28FB4086; Tue, 16 Jun 2015 12:43:55 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87r3pitmcb.fsf@web.de> <87ioasdeap.fsf@web.de> Date: Tue, 16 Jun 2015 12:43:55 -0400 In-Reply-To: <87ioasdeap.fsf@web.de> (Michael Heerdegen's message of "Fri, 12 Jun 2015 19:31:10 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.71, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TRANSFR 0.11, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.9 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) >> We currently don't have a special "fail" pattern which simply never >> matches. Of course, you can make one up (e.g. (guard nil)). > (or) would also do it, but raises (error "Please avoid it") (BTW > (or _) raises that error, too). Why are those (error "Please avoid it") > calls useful? IIRC handling them well (i.e. generate efficient code) required more effort than I was willing to invest, or something like that, and IIRC they should only show up in unusual cases, so I made them signal errors, to try and see when/where those cases show up. So far I never bumped into them and haven't received any bug report about them either. We should probably remove them, tho, because those corner cases may be annoying to avoid when doing metaprogramming. >> That's pretty much what SELFQUOTING is. IF you think renaming it to >> ATOM would help, then we could do that. > I would prefer that over SELFQUOTING OK, changed. > because > SELFQUOTING is a shorthand for 'SELFQUOTING. > sounds like a tautology. As a teacher I was taught that redundancy in explanations is good ;-) >> As explained the use of `eq' is supposed to be a pure optimization with >> no semantics effect. > I see. Then I guess it would make sense to merge these two lines in the > ` doc? > STRING matches if the object is =E2=80=98equal=E2=80=99 = to STRING. > ATOM matches if the object is =E2=80=98eq=E2=80=99 to = ATOM. Yes, thank you, done. Stefan From unknown Mon Jun 23 06:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20784: 25.0.50; pcase documentation on t and nil Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Jul 2016 02:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20784 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Heerdegen Cc: Stefan Monnier , 20784@debbugs.gnu.org, Artur Malabarba Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.14673407703020 (code B ref 20784); Fri, 01 Jul 2016 02:40:01 +0000 Received: (at 20784) by debbugs.gnu.org; 1 Jul 2016 02:39:30 +0000 Received: from localhost ([127.0.0.1]:32942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bIoMb-0000mZ-OA for submit@debbugs.gnu.org; Thu, 30 Jun 2016 22:39:29 -0400 Received: from mail-it0-f49.google.com ([209.85.214.49]:33301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bIoMZ-0000mH-Kp; Thu, 30 Jun 2016 22:39:28 -0400 Received: by mail-it0-f49.google.com with SMTP id f6so6489994ith.0; Thu, 30 Jun 2016 19:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=PRjIP96dnRd0eSKDEZvV2gae0+8SQ9xCvCTh/PdFTW4=; b=0ulnui5pruHEfKWVPIchi4pXlflTLHV5EscDBt5zLRPIMbaUaS15CEBwYWH26j7yRq lhLsxlkPdBiXfAUty07p0Z/1lPkKGPijRXQ7PHcQ1DVAd+d+fqBcU5KORErU4rR555SQ Pa0tCKqu6HMTzdww6kRpxP9FfqXRfx5pICzSKEXUHjCg3Lky8efEN+bwlCsMfbUPI05S VfOhSzMuAROJgZ1Hvlqs4jRbBISr4bsYDROfkoYoe3R5T3Gpri+JGp6AaqwNuX59NZOf msPLrIqOajb992WpaWQiGaB/Ku1eLkK8Yljt4e4V70bs2ssqCotHrZxm0OqcnUdYe4xY 0neA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=PRjIP96dnRd0eSKDEZvV2gae0+8SQ9xCvCTh/PdFTW4=; b=SYDlTs2oh/k5qoDP5qtZ4zchi6dy6l0WnqwPtMU5VC3pJkk2YdsaiykxYP7i5vvBDa 5fbIV5u9qQZoww9TENPmudOPlo7+8Zao3fB6QMCJlGfhc1x8w+f7+VKy9MaaTfDEnlIP nsM9BHuch+QF9ouFRH2GjCUoeFvhfRZAV7hmMDgTaRObBU3+4vUAGZFqYRxYWrXHLymh cXWOi+xdqGv623ujaUTREeiOLLXguHyyHqT1ocyPFb2msDct9wtlOiNXThRF08SkvOrB GruUcdJ9AaWpepK/y+72UHVX5+8st0kSbdEbCHzRBOnkXuVeBNmV8KA+Qp0nd8nz6Qee gWvg== X-Gm-Message-State: ALyK8tJCLZENJdjLb8faP+cw8D1mlvDt/qx/yenBuIJ/olhjG1dooOYAYHX4OMCpNgA8kg== X-Received: by 10.36.43.88 with SMTP id h85mr9054431ita.89.1467340761922; Thu, 30 Jun 2016 19:39:21 -0700 (PDT) Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id q128sm1199470iod.30.2016.06.30.19.39.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jun 2016 19:39:21 -0700 (PDT) From: npostavs@users.sourceforge.net References: <87r3pitmcb.fsf@web.de> <87eglgde2k.fsf@web.de> Date: Thu, 30 Jun 2016 22:39:28 -0400 In-Reply-To: <87eglgde2k.fsf@web.de> (Michael Heerdegen's message of "Fri, 12 Jun 2015 19:36:03 +0200") Message-ID: <87mvm2hyjj.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) tags 20784 fixed close 20784 25.1 quit Michael Heerdegen writes: > Stefan Monnier writes: > >> How 'bout the following patch? >> >> * lisp/emacs-lisp/pcase.el (pcase): Reword the SELFQUOTING case. >> (pcase--split-pred, pcase--self-quoting-p): Restrict selfquoting >> numbers to integers. >> (pcase--u1): Deprecate t patterns. Reject nil as an invalid pattern. > > Thanks, that looks good to me. Comments in my message above. Closing, since this appears to have been applied.