From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#31350: 27.0; `pcase' message: "Redundant pcase pattern" Date: Sat, 3 Oct 2020 19:06:46 -0700 (PDT) Message-ID: References: <86d352f4-5fa7-4bee-b72c-17e58aace43f@default> <87364hs46h.fsf@gnus.org> <87sgaudiss.fsf@web.de> <8bcc3be5-c9db-4015-8f0f-4efe77ff27ee@default> <87sgau93fh.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10173"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , 31350@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 04 04:09:11 2020 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 1kOtSY-0002Xh-Dq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Oct 2020 04:09:10 +0200 Original-Received: from localhost ([::1]:44710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOtSW-0003z2-VY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Oct 2020 22:09:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOtSQ-0003yl-Qm for bug-gnu-emacs@gnu.org; Sat, 03 Oct 2020 22:09:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kOtSQ-0001Aa-H1 for bug-gnu-emacs@gnu.org; Sat, 03 Oct 2020 22:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kOtSQ-0005qU-BW for bug-gnu-emacs@gnu.org; Sat, 03 Oct 2020 22:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Oct 2020 02:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31350 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 31350-submit@debbugs.gnu.org id=B31350.160177733822459 (code B ref 31350); Sun, 04 Oct 2020 02:09:02 +0000 Original-Received: (at 31350) by debbugs.gnu.org; 4 Oct 2020 02:08:58 +0000 Original-Received: from localhost ([127.0.0.1]:44672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOtSM-0005qB-19 for submit@debbugs.gnu.org; Sat, 03 Oct 2020 22:08:58 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:54848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOtSJ-0005pw-Mw for 31350@debbugs.gnu.org; Sat, 03 Oct 2020 22:08:56 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09427nAP183880; Sun, 4 Oct 2020 02:08:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=2Sk5RVuL3PZWdl2d7xR+lCkjUBB46KmA7Vs8EO4k5pU=; b=orY2U/TUT0N8lhgifbHvRknQtsyIU2+i4tuomRPDgnRWAU82B0Zrv0DBA8+XtzQMPzRx hG2lMIQ4VRfviDxpUyg0Gvf1KAuXq5A5aWxc4YK73JZzwe46dnJuKDzQcv41hSPZRKfg zWJCAGaZaFpcNq8mBvV6tfRKL+mnB4xy/BLcAGwBI9D1BxjfJpH2FcXKEBnsSxfjiMRs jeP38MdjmmlIeGhi5P7BpV2ZKqx0i7z581SqSCk1I/vA84Of+uOsb337QMG6a1BprK2J Ra+Omf+jxxYIEeXbZwHCxrQcydY8ScoixBZ4O9r6AsjUHHYb1wWMIswD44Z9qKeGtJEc Lw== Original-Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 33xhxmhjn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 02:08:48 +0000 Original-Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094251MV058402; Sun, 4 Oct 2020 02:06:48 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 33y32n3uuy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 04 Oct 2020 02:06:48 +0000 Original-Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09426lF3021445; Sun, 4 Oct 2020 02:06:47 GMT In-Reply-To: <87sgau93fh.fsf@web.de> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5056.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9763 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040014 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9763 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040014 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" Xref: news.gmane.io gmane.emacs.bugs:189735 Archived-At: > > I'll repeat the request, which is what I think a user > > would like to know: > > > > Can the messaging at least tell you: > > (1) all of a set of clauses that are mutually redundant and > > (2) which one of them will actually be used by the compiled > > code, the others presumably having been pruned? > > > > IOW, what's the actual effect, for users? How does pcase > > deal with the redundancy? Can that at least be documented > > somewhere (maybe it is already)? >=20 > I think you make an error in reasoning: we don't have mutual redundancy > here. A case can be redundant when it will never match because whenever > would match, a previous case in the cases list always matches, so it is > effectively shadowed. But this is not symmetric (cases are always tried > from first to last (!), and e.g. a `_' catchall pattern in one case will > make all following cases redundant, but not the other way round). >=20 > I think the message is more like a warning that a case can never match, > and in all cases where this happened to me, as also in your case, the > reason was a very obvious editing mistake. I don't think there is much > to say here, Emacs just tells you: this case here will never be used, > look what you have done wrong. There is a problem with your code > whenever you see that message. And there is nothing to say about the > semantics as well. >=20 > BTW, I think the implementation only covers the most obvious and > simplistic cases, like those involving catchall patterns or duplicated > patterns. If what you say is the case then the help should tell users that. To me it's not obvious. And even if a user (somehow) understands that later cases are made redundant by earlier ones, how to tell which earlier ones are implicated?