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: Thu, 24 Dec 2015 18:46:36 +0100 Message-ID: <87poxvivsz.fsf@web.de> References: <20151216202605.GA3752@acm.fritz.box> <87mvt859cw.fsf@russet.org.uk> <87poy2tqrc.fsf@web.de> <87mvt6nsxr.fsf@russet.org.uk> <87oadmkuwd.fsf@web.de> <874mfenltp.fsf@russet.org.uk> <87oadltfcc.fsf@web.de> <8737uxgdh1.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1450979233 31681 80.91.229.3 (24 Dec 2015 17:47:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Dec 2015 17:47:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: phillip.lord@russet.org.uk (Phillip Lord) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 24 18:47:04 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 1aC9yh-0003Yy-5S for ged-emacs-devel@m.gmane.org; Thu, 24 Dec 2015 18:47:03 +0100 Original-Received: from localhost ([::1]:32898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aC9yg-0006AY-Fu for ged-emacs-devel@m.gmane.org; Thu, 24 Dec 2015 12:47:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aC9yS-0006AQ-3j for emacs-devel@gnu.org; Thu, 24 Dec 2015 12:46:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aC9yN-000391-4G for emacs-devel@gnu.org; Thu, 24 Dec 2015 12:46:48 -0500 Original-Received: from mout.web.de ([212.227.17.11]:50024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aC9yM-00038A-Qj for emacs-devel@gnu.org; Thu, 24 Dec 2015 12:46:43 -0500 Original-Received: from drachen.dragon ([90.186.2.171]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LshWf-1aJCFF1yCP-012HOK; Thu, 24 Dec 2015 18:46:40 +0100 In-Reply-To: <8737uxgdh1.fsf@russet.org.uk> (Phillip Lord's message of "Sun, 20 Dec 2015 18:51:54 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:eYeUyHwjTo1jsaqQyglo+NOlW/H6jPnFa1e5LoSqLKqL2oPGHku 6OY5Sfo1swcmJ7r0jumOQTNmvbTXBBZBPc0eo8FBSNKa07PEKoo/pM4P4HWHs6TnG1tlJ4A pDOVXf3nm+pxoLoFQzKHcyRqYJVJLWGUWNYzT1oRtWH5wEtwa1BwbYNTTUgnGRBT06vy5Ee RFmAHv3Ww42nl1amcQrUA== X-UI-Out-Filterresults: notjunk:1;V01:K0:EnyBKFQnzt0=:nrrc9a9H3LhbY3EdaN/ryJ ufhTQX3mOOrhZ27dpJJQI5nIi3H56HycdWk5l82h0sbhruddkR4s9k5Bk6ngSHNotWiJpE4XS 189JgEWBQdj6Qs3oyt0FgIZNbXoEmzdaymeCnkjixhf5F6+/i+buTZxH6r5Kx4209LogiTdRo z/KA9Cqt7RRpjH6UAA+KFa6ZYWUnC/rSZTrxH6c7wEXKPyqTu8f93vyPoy/HZj4TXlbi1Nrqd xZjjWowdP3psMlas3EumfM0H61BJCBDz7Lx6Ro/NfbEjnaxf3eZElIZ4twHiOzxRH7tk7f/Id WOEdF4wWJccGhXbwbXJ2EZ6Z/84o4HW7+6mgmG67l0twujpJDOeQYQl/fNQrtOtm7+/oROGQf V9+lvmN37ElNsReNxWFJNgEzq620V0K5e5MEfu6XtI21jrJhuWju+kJo7LPpt4Gz1FdJpyrf0 PSH8pO/rZqnOKpAM4K3ZuX/u9kv4P4nGh3hlvw1436XJzdTYFXpyi1vjJWFu3Qv9y8PTU39oJ 4dJQaKfs3DV1NIKjm0YTpm+6D6jJJ1d6aihyPAUxWPvWxBqJqEZdsHBYS4TbO3T/PIfEDdLH9 9FJyhbgMm9VuvuSNFJm25IjEntYENXcKhxYoOxQ503s0fOmG2aOghHyiOxIBRVH5mDfpryOGq AcN1+lkAcsBc+WTX9Q7MM+Atevx0dHkK1DM8+Bm1C7BBOT8kC9nr/r6+3RKQ+jPWEDjhmpQiZ K9Suhgod3tw10QJ1fM0Og4cbrAQJ3egECdvGSHD/t0LPuLwD6ek8cdJojmr8b4Iwgf4kpZpS X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.11 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:196778 Archived-At: phillip.lord@russet.org.uk (Phillip Lord) writes: > I do worry that the syntax of pcase is too complex. As an example > compare dash.el and pcase: > > (-let [(a b _) '(1 2 3)] > (list a b)) > > (pcase-let > ((`(,a ,b ,_) '(1 2 3))) > (list a b)) -let is only about binding. pcase, and it's ` macro, is about matching and binding, including condition testing etc. Since the latter offers more features, it is not a surprise that it can be beaten by specialized tools in special cases wrt the length of the call. > I've chosen an extreme example here, I don't think that three additional colons are extreme. > but the pcase version has a lot of punctuation (and worth remembering > however familiar the macro expert is with punctuation not all > emacs-lisp programmers are). You can just use the `seq' pattern type if you are not familiar with punctuation. > > This would mess up the semantics to the worse: `_ would > > then be a pcase pattern matching anything. Should '_ also match > > anything? But how to match the symbol _ then? If not, why should `_ be > > different from '_ when there is no unquoting involved? > > > > Or should _ as a QPAT only behave different when used "not at toplevel"? > > This would be horribly inconsequent: We would get two different types of > > QPATs: toplevel QPATS, and non-toplevel-QPATS. That would confuse > > people even more, a pain to explain and to internalize. > > I thought we were not going to mention q-patterns any more! I never said that. "qpattern" is a useful term when describing the ` pattern. What I said was we should avoid the old term "upattern" for general type pcase patterns. > I think that too much of the implementation semantics is poking > through into the syntax. It's a good thing if the syntax reflects the semantics. And I don't think that Stefan had let the semantics be dictated by implementation details. > I suspect no one would notice if "_" matched anything inside a > backquoted list, because it feels natural. It doesn't feel natural anymore once you have used the thing yourself and understood the concept. Yes, pcase does look unusual at the first look, as does Lisp, but it won't kill you, I promise. Just give it a chance. Regards, Michael.