From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: pcase-if-let? Date: Wed, 28 Mar 2018 21:14:01 -0700 (PDT) Message-ID: <60dc117a-7ee2-42d2-acbc-49dae9ec6ae1@default> References: <871sg3eqi5.fsf@web.de> <0e8139b0-b59c-1d7e-29db-66170858f8ca@lanl.gov> <87woxvd947.fsf@web.de> <87605filw6.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1522296982 18375 195.159.176.226 (29 Mar 2018 04:16:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 29 Mar 2018 04:16:22 +0000 (UTC) Cc: Emacs Development To: Michael Heerdegen , Davis Herring Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 29 06:16:18 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f1Oz4-0004h9-70 for ged-emacs-devel@m.gmane.org; Thu, 29 Mar 2018 06:16:18 +0200 Original-Received: from localhost ([::1]:44227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1P17-0004dG-Lw for ged-emacs-devel@m.gmane.org; Thu, 29 Mar 2018 00:18:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1OzH-0003e8-Af for emacs-devel@gnu.org; Thu, 29 Mar 2018 00:16:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1OzE-0004wP-4v for emacs-devel@gnu.org; Thu, 29 Mar 2018 00:16:31 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:49856) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1OzD-0004vq-S9 for emacs-devel@gnu.org; Thu, 29 Mar 2018 00:16:28 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2T44rlg030293; Thu, 29 Mar 2018 04:16:25 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-2017-10-26; bh=bRj93oLCzt76XdS24ZKBJptHjDAFB83nNkaPeMgbvIU=; b=HJtXDfJt3GgkHqwOP4nEaUjKd3a6EtpWp9Cn159hMD9DkB9cq+DMvPsqO35FZjCBJDYD /M31u6MAd+kM1BSQahssKirKRTvMkC8+tO2+LWFbFIbKI5BK3kD5GD9UpqguT3KaGwQk z0YtONBxwsfFmxhyDi0AR+VwC8IrMHBb1SjPdNPJECnESU9j1oAHwEqy2EeA80hR8QLf PHBze9Cgmt9LwaVsEo7H6v0PAjfUT6v0vt79WPHUl6NkcJ7kekhKOd3FIlpKK8Mr5yAO uMW4/haTdooFcrkEKLjKpIv6KHrs7eODvqF3/HnHfTnq6coLQPzEvSmV4tr059MW021M gQ== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2h0rs881hw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Mar 2018 04:16:25 +0000 Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2T4E9Fv032195 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Mar 2018 04:14:09 GMT Original-Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2T4E8rF024321; Thu, 29 Mar 2018 04:14:09 GMT In-Reply-To: <87605filw6.fsf@web.de> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4666.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8846 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=639 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803290046 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:224134 Archived-At: > #+begin_src emacs-lisp > (defmacro pcase-if (clauses then-form &rest else-forms) > "Eval THEN-FORM or the ELSE-FORMS depending on CLAUSES. > CLAUSES is a list of the form \((PATTERN VALUE-FORM) ...) We usually try to describe the args in order (first CLAUSES then THEN-FORM, then ELSE-FORMS. So, for example: Depending on CLAUSES, evaluate THEN-FORM or ELSE-FORMS. > Successively try to match every `pcase' PATTERN against > its VALUE-FORM. When all match, eval THEN-FORM, else the > ELSE-FORMS." About the name "pcase-if"... If that's what this does then why does the name instead tell us "case" (suggesting a selection, e.g. one of several cases)? The name might be better off telling us that this is an `if-all-match' (or even just `if-all'): If ALL of the clauses match then do THEN-FORM, else do ELSE-FORMS. It's the "all" and the "match" that are important, together with the fact that this is an if-then-else. It's not really about "case" at all (except in the sense that there are two cases: THEN and ELSE). In Lisp, a `case' construct, like `cond', has always been about choosing among multiple cases, not just a single test with two case outcomes. And why the asymmetry between THEN being singular and ELSE being plural? Emacs-Lisp `if' has such an asymmetry (for a couple of reasons, which aren't particularly relevant here), but why should this `pcase-if' construct be asymmetric? Why not make it symmetric, like `cond' (and `case'), since it's already a complex, multipurpose critter? I'm guessing that all of this `pcase-*' stuff has taken its names from `pcase'. But that just took its name, AFAIK, from `case' and "pattern". This naming is no longer relevant, is it? There's no set of "cases" involved. Is there really a big benefit in naming everything that uses a "pcase-style" pattern "pcase-"? Presumably you want to use similar names to convey the fact that they all do pattern-matching. But if what these things have in common is the _pattern_ (and they all share the same kinds of pattern-matching, for the most part), then why emphasize "case" in the name? And why make people guess that the "p" stands for "pattern" and is what these are all about? Not that I really care much - don't get me wrong. I just don't find such names very helpful. They don't really say what they're about (not very discoverable).