From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Question on pcase Date: Fri, 23 Oct 2015 09:30:02 +0300 Message-ID: <83r3kmrtat.fsf@gnu.org> References: <871tcngdv2.fsf@gmail.com> <87k2qe1u09.fsf@web.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1445581818 11412 80.91.229.3 (23 Oct 2015 06:30:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Oct 2015 06:30:18 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 23 08:30:10 2015 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 1ZpVra-0001lR-Nx for ged-emacs-devel@m.gmane.org; Fri, 23 Oct 2015 08:30:06 +0200 Original-Received: from localhost ([::1]:36374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpVra-0008WO-1k for ged-emacs-devel@m.gmane.org; Fri, 23 Oct 2015 02:30:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpVrX-0008WH-7y for emacs-devel@gnu.org; Fri, 23 Oct 2015 02:30:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpVrU-0003FE-0A for emacs-devel@gnu.org; Fri, 23 Oct 2015 02:30:03 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:63859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpVrT-0003En-O8 for emacs-devel@gnu.org; Fri, 23 Oct 2015 02:29:59 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NWN00800TXK1K00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Fri, 23 Oct 2015 09:29:59 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NWN0076XU1YYQ50@a-mtaout22.012.net.il>; Fri, 23 Oct 2015 09:29:59 +0300 (IDT) In-reply-to: <87k2qe1u09.fsf@web.de> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 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:192449 Archived-At: > From: Michael Heerdegen > Date: Thu, 22 Oct 2015 23:19:18 +0200 > > > To be frank, I'm not a fan of `pcase', and really prefer a "for dummies" > > coding style. But if it makes other people feel more productive, I'm > > fine with it as long as I can read and debug it. > > > > One piece that I'm missing currently is the ability to eval a `pcase' > > pattern. > > Did you try to `macroexpand' a pcase form? The result is readable, > though a bit long. > > Note that `pcase' doesn't set variables, it is a binding construct. > > Since the "matching" part and the "binding" part aren't separate, but > binding happens as a side effect while matching, your approach to > understand the thing seems not good to me. > > IME the best way to transform pcase expressions into a readable form is > to learn to read them. I can only advertise to give it a try. A good > starting point is > > (info "(elisp) Pattern matching case statement") > > (can be improved...) > > But I totally understand if you don't want to learn it. FWIW I never > understood bash syntax, and also don't want to learn it :-P Maybe we should have some higher-level facility to expand a pcase into a human-readable form. Would something like this be possible and useful?