From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: The poor state of documentation of pcase like things. Date: Sun, 03 Jan 2016 02:32:58 +0100 Message-ID: <878u47wiph.fsf@web.de> References: <20151216202605.GA3752@acm.fritz.box> <87io3m60bq.fsf@web.de> <877fk1nnk0.fsf@web.de> <8760zlue3j.fsf@gmail.com> <87vb7kajgv.fsf@web.de> <83y4c9ag06.fsf@gnu.org> <87bn95m9eg.fsf@fencepost.gnu.org> <5686CDFB.2010105@dancol.org> <83fuygcs5g.fsf@gnu.org> <56886E32.70305@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451784833 12497 80.91.229.3 (3 Jan 2016 01:33:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jan 2016 01:33:53 +0000 (UTC) Cc: Eli Zaretskii , Daniel Colascione , emacs-devel@gnu.org, dak@gnu.org, Dmitry Gutov To: Lars Magne Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 03 02:33:43 2016 Return-path: Envelope-to: ged-emacs-devel@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 1aFXYE-0004um-F9 for ged-emacs-devel@m.gmane.org; Sun, 03 Jan 2016 02:33:42 +0100 Original-Received: from localhost ([::1]:40245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFXYA-0006jR-Jw for ged-emacs-devel@m.gmane.org; Sat, 02 Jan 2016 20:33:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFXXv-0006jI-5q for emacs-devel@gnu.org; Sat, 02 Jan 2016 20:33:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFXXr-0000sS-6P for emacs-devel@gnu.org; Sat, 02 Jan 2016 20:33:23 -0500 Original-Received: from mout.web.de ([212.227.17.12]:56750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFXXm-0000rq-DL; Sat, 02 Jan 2016 20:33:14 -0500 Original-Received: from drachen.dragon ([90.186.1.98]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MddBI-1aaLeE3C9M-00PPnI; Sun, 03 Jan 2016 02:33:03 +0100 In-Reply-To: (Lars Magne Ingebrigtsen's message of "Sun, 03 Jan 2016 02:07:57 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:ncnjOQ4hm5+dSuejXaQBh24TN0ovBku2DZdU1RUvNJyyFU06K/V hUE+o32lLYIjTV8ZhzEZ5dCBS6XUOzcEYfRgPt0wjWJsRjIZpBB7xhIHHH1q9KfzgoTZPrQ p/XOEpzn7pGadm8KpKAfd0l2faO0bkJfRPP66RGDGxc2lAZsIVTvQeTdM5NB7PgIIwZtVta J8fWS893+JP1kELPPFkgw== X-UI-Out-Filterresults: notjunk:1;V01:K0:67djOx9N5Fs=:huntR5OHFsuDPppgAS9I/L fHjpRkInMMgq/wGecTH3lhKuz87KBwo1nWRGB1Fcj090yTAkv86Az1G06PRoA2KkZuopQ7ICg WttJW3LPxtX6JiUtRUE6Mw2Jm7w52ShBycernfFenGYDt3qhJ4coyX9HqKCmbpyLi5lGWdhy0 CTfzV1aSjApDtDoBKyVoGSKUJcEq0nqp5CdzBOJah+c8zy2Ee13XWH2Yf/X4u9Ku9AL6gVVBZ M6gX2PDNXGKSfxD3pfbqF3h1kgjG1EDT6FpesRaVSuAGcX1T4g7ffXfPd8m05PL2aIiNodNyS uZsdIS7Xjo8xx2zDxVt1ZUQTB4j31aahegTVz9PmJJfebxBmGtqDsF1ho/Am7UDw58cD7XmWw micr7GWaFswfNl5Vf3Ro5zRRCFQ9oTTtcebU8hgsR35CjkoyCrwyw4hiHV0f8/hiS5olDTWc5 9pLK7kl8YDI9H2zeDKgF3xG7u0pzJD4QJpMNhtv5QRNcj9TKfaF1TcQ6/ALy2KN2MMH0DCmTN pGkpV+AcxG8dsNplGQoBP+Grn/Iq1XZ1PvTYEYcBlGSZQjN2x0QQEkl2xbsfZd2lo7ofllV8l nSWTKSrHVNCzDK1ZZOFN8FmY9Qn8pwGeFUNWq9ARTvHr5+ctrKJ9WkNxxQOo3z+xgKrgdkXos Uo3P2WWhHRFiQVyEdLr9i9FhtkpJbvstmpph7BG0sbYr7iD0ALRHi9wNJlXF3o71peahSu5UE 8TCBHxASfsTrr+UB6G5N+8+e/ku7CiNcZY+a14wn03MYokkKkU7IilFYlxnnOYzJPShJndCS X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:197397 Archived-At: Lars Magne Ingebrigtsen writes: > Well, I'd say that pcase is kinda awkward because you can't tell by > skimming whether it's complex or not (which is something it shares with > cond, in a way). Take for instance the following I was reading in > url-http (simplified and way shortened): > > (pcase status-symbol > (`unauthorized ; 401 > (url-http-handle-authentication nil)) > (`payment-required ; 402 > (url-mark-buffer-as-dead buffer) > (error "Somebody wants you to give them money")) > (`forbidden ; 403 > t) > (`not-found ; 404 > t) > (`method-not-allowed ; 405 > t) > ...) > > The only way you'll know whether `status-symbol' is really a symbol, and > all the cases are really symbols, is by reading the entire thing. The > 44th case could have been (_ foo bar zot), for instance. That code indeed looks weird. But you can also write similarly weird code with `cond'. > I kinda liked pcase at first, but the more I see of the pcase language, > the more sceptical I get. I'm beginning to wonder whether the whole > thing is a misfeature that should be replaced with several separate > operators. The concept (one can combine different types of things and tests - destructuring, predicate testing, matching against constants etc.) has it's pros and cons. In cases where one single tool doesn't fit, it is a very good thing when the code doesn't need to nest different types of tools, and the layout can concentrate on the different cases. Michael.