From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: The poor state of documentation of pcase like things. Date: Sun, 03 Jan 2016 02:07:57 +0100 Message-ID: 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 1451783328 20644 80.91.229.3 (3 Jan 2016 01:08:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jan 2016 01:08:48 +0000 (UTC) Cc: michael_heerdegen@web.de, Eli Zaretskii , Daniel Colascione , dak@gnu.org, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 03 02:08:38 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 1aFX9v-0005M8-RG for ged-emacs-devel@m.gmane.org; Sun, 03 Jan 2016 02:08:35 +0100 Original-Received: from localhost ([::1]:40214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFX9v-0002kV-3m for ged-emacs-devel@m.gmane.org; Sat, 02 Jan 2016 20:08:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFX9r-0002kE-DG for emacs-devel@gnu.org; Sat, 02 Jan 2016 20:08:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFX9m-0004tJ-EG for emacs-devel@gnu.org; Sat, 02 Jan 2016 20:08:31 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:35421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFX9m-0004sm-3m; Sat, 02 Jan 2016 20:08:26 -0500 Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aFX9J-0001cB-SF; Sun, 03 Jan 2016 02:07:57 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUAAAAOCwoDAQJrX1cD AwMBAQECAgJYo5WBAAACOklEQVQ4jXVTQW7cMAxkgTDnCnb6gn7AWKDnGNXqzAAmzz5I/P8TOqTs pIdWu9gFNCJnSA6pPP59qPzn0J5/a8Xp1b3Xul9AXLk1VWXVpg4cYKW8HyddhxlQA0qRwUz1RkjU bHSPCHcV+QwhxjNTAAgcnwHCIqDDxU8A7kP0/Q5RracaIoZrG/HqKTwOa/u6jgB8INBOEhtBZs+9 1RpA3CMcLGZyQEZ3AEpNhwjUg9d5sqihYqTSuFcJRTd/1NWfFlq/CoQsQRB1SOZ4/heSQEUEGCLL vn71JTlCEr7L41GIr2xHyMUB7wfGtv2Y74kAuERrhGKeWxHKoIh4opdm57cElu8UJTHI0cAYgH5M D7zlsFAZUhlHQTuoy7JNeuGogySGUJYAoOtqS6oSpC1lKyUEzyYcaGJ2RAskoZItgSg4ZwSy35N8 6xXdPpAjpupCnPU9ll/SK4qSVwAxVTy66uDsPkdE1K0soF5KQRuiIxiF93ZGy+UlHJtWmfPQYwzk xOco5S0rUHOMVv0ZpT/pmhWHM/biNNK4YfXb1VFIUxrdwA0anZ2ADGEdTG4YIYVjE8A9TBfa4D9K v7Hc1lU2cwCpfPoBP+zB7p0szQAtEWDw2oj3AI6GZoEuXYqgFyRyuJfgUx3TZgDThwa7x3KaXgai VzQADbVYauoNG6UpIRcQxLnssZxtdvicCGJ6RNTWMUTj0yRWV03GsSZH85yVXBudqDajdbohlPK9 Jaj3oIJEMByl1PmVV+X9D8TV4dfMP4bjAAAAAElFTkSuQmCC In-Reply-To: <56886E32.70305@yandex.ru> (Dmitry Gutov's message of "Sun, 3 Jan 2016 02:41:22 +0200") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aFX9J-0001cB-SF MailScanner-NULL-Check: 1452388078.50815@g0hCHtzhrTCK5lUfhbu/5Q X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 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:197394 Archived-At: Dmitry Gutov writes: > On 01/02/2016 10:16 AM, Eli Zaretskii wrote: > >> Now that I know there isn't, I can convert such code to using 'cond' >> whenever I feel like it. Like we do with whitespace changes. > > FWIW, converting that kind of pcase form to a cond, to my eyes, would > look like replacing (when ...) with (if ... (progn ...))). 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. In Common Lisp, you'd say (case 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) ...) and you'd know that this was a simple `eql' thing going on here. 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. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no