From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Wed, 24 Oct 2018 16:12:26 +0000 Message-ID: <20181024161226.GA8885@ACM> References: <87egdy8tyz.fsf@fencepost.gnu.org> <56895FDE.4060406@yandex.ru> <8760za8r4a.fsf@fencepost.gnu.org> <87h9iunkcg.fsf@web.de> <87h8hc4xw2.fsf_-_@web.de> <83tvlcsnee.fsf@gnu.org> <87pnw037ar.fsf@web.de> <83ftwvs7y9.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1540397988 29449 195.159.176.226 (24 Oct 2018 16:19:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 24 Oct 2018 16:19:48 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 24 18:19:43 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 1gFLsk-0007Vi-Ns for ged-emacs-devel@m.gmane.org; Wed, 24 Oct 2018 18:19:42 +0200 Original-Received: from localhost ([::1]:49353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFLur-0001ay-AS for ged-emacs-devel@m.gmane.org; Wed, 24 Oct 2018 12:21:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFLuk-0001ag-34 for emacs-devel@gnu.org; Wed, 24 Oct 2018 12:21:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFLug-0003r6-36 for emacs-devel@gnu.org; Wed, 24 Oct 2018 12:21:46 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:52119 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1gFLue-0003ZX-P2 for emacs-devel@gnu.org; Wed, 24 Oct 2018 12:21:41 -0400 Original-Received: (qmail 64144 invoked by uid 3782); 24 Oct 2018 16:21:23 -0000 Original-Received: from acm.muc.de (p5B147470.dip0.t-ipconnect.de [91.20.116.112]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 24 Oct 2018 18:21:22 +0200 Original-Received: (qmail 8950 invoked by uid 1000); 24 Oct 2018 16:12:26 -0000 Content-Disposition: inline In-Reply-To: <83ftwvs7y9.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 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:230636 Archived-At: Hello, Eli. On Wed, Oct 24, 2018 at 18:03:26 +0300, Eli Zaretskii wrote: > > From: Stefan Monnier > > Date: Tue, 23 Oct 2018 14:12:34 -0400 > > > I think so too, but it seems the majority of developers has a different > > > option, at least in this (old) thread. > > So I guess I'm gonna have to try and argue my case. > > OK, here are the advantages I see for `cl-case`: > FWIW, my main problem is not even with cl-case, it's with 'cond'. It > seems like we have some 'pcase' epidemic, whose first symptom is that > people stop using 'cond' and start using 'pcase' instead. A few > examples: [ .... ] > My favorite is imap.el, which does something like the above in 3 > nested levels. I will spare you the code, you can look it up. > Is it because people are too lazy to write (eq a b) as part of 'cond'? > Or is there something else I'm missing? > You may wonder why I'm bothered by such uses. It's because people are > evidently confused by 'pcase's arcane syntax, and therefore produce > obfuscated code even in the simple usage. For example: [ .... ] I'm somebody else who doesn't like pcase. I don't like the way it has purloined symbols which previously had a strong fixed meaning (``', `,', `and', `or', and possibly more) and rendered them vague and with several context dependent meanings. For an Emacs Lisp beginner, `and' and `or' used to be easy to grasp, once past the concept of short-circuit evaluation. ``' and `,' were somewhat more difficult. Now, given the ambiguity introduced by pcase, they are all much more difficult to understand. The documentation for pcase is now good, but it still gives me a headache to trundle through it. Unless it's changed very recently, that for pcase variants such as pcase-let is still inadequate. I find pcase uses hard to understand, and definitely prefer cond. [ .... ] > We have dozens of such fragments in our codebase, which just makes the > sources harder to read, especially for people who aren't fluent with > 'pcase' (which seems to be the case with many of us). > So I think we should begin by rewriting all of such uses as simple > 'cond', and ask contributors not to use 'pcase' where a simple 'cond' > will do. +1. -- Alan Mackenzie (Nuremberg, Germany).