From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#20784: 25.0.50; pcase documentation on t and nil Date: Thu, 11 Jun 2015 12:22:28 -0400 Message-ID: References: <87r3pitmcb.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1434039804 17444 80.91.229.3 (11 Jun 2015 16:23:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Jun 2015 16:23:24 +0000 (UTC) Cc: Artur Malabarba , 20784@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 11 18:23:11 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z35G3-0005YN-2i for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Jun 2015 18:23:11 +0200 Original-Received: from localhost ([::1]:47672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z35G1-0006EM-VW for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Jun 2015 12:23:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z35Fx-0006E4-LM for bug-gnu-emacs@gnu.org; Thu, 11 Jun 2015 12:23:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z35Fu-0007UP-Bq for bug-gnu-emacs@gnu.org; Thu, 11 Jun 2015 12:23:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z35Fu-0007UC-8G for bug-gnu-emacs@gnu.org; Thu, 11 Jun 2015 12:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z35Ft-00083h-Lo for bug-gnu-emacs@gnu.org; Thu, 11 Jun 2015 12:23:01 -0400 X-Loop: help-debbugs@gnu.org 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: Original-Received: via spool by 20784-submit@debbugs.gnu.org id=B20784.143403977430964 (code B ref 20784); Thu, 11 Jun 2015 16:23:01 +0000 Original-Received: (at 20784) by debbugs.gnu.org; 11 Jun 2015 16:22:54 +0000 Original-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 Original-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 Original-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) Original-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) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 418A7B416C; Thu, 11 Jun 2015 12:22:28 -0400 (EDT) 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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103830 Archived-At: > (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