From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources] Date: Mon, 29 Oct 2018 00:57:51 +0100 Message-ID: <87zhuxhbeo.fsf@web.de> References: <20151216202605.GA3752@acm.fritz.box> <87oad2irtd.fsf@fencepost.gnu.org> <5689456A.1010601@yandex.ru> <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> <877ei7mkfh.fsf@web.de> <87a7mze7tl.fsf@web.de> <87zhuykjjh.fsf@web.de> <871s8aesdc.fsf@portable.galex-713.eu> <87tvl6dc3e.fsf_-_@portable.galex-713.eu> <87efc9isxj.fsf@web.de> <87tvl5653j.fsf@portable.galex-713.eu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1540771016 30232 195.159.176.226 (28 Oct 2018 23:56:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2018 23:56:56 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii , Dmitry Gutov , Stefan Monnier , emacs-devel@gnu.org To: "Garreau\, Alexandre" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 29 00:56:52 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 1gGuvK-0007k2-Mx for ged-emacs-devel@m.gmane.org; Mon, 29 Oct 2018 00:56:50 +0100 Original-Received: from localhost ([::1]:42668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGuxQ-0003gL-N5 for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2018 19:59:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGuwm-0003gG-Ia for emacs-devel@gnu.org; Sun, 28 Oct 2018 19:58:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGuwl-000726-Ms for emacs-devel@gnu.org; Sun, 28 Oct 2018 19:58:20 -0400 Original-Received: from mout.web.de ([212.227.17.11]:47979) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gGuwf-0006zy-RT; Sun, 28 Oct 2018 19:58:14 -0400 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Ma2U7-1g03yw41pH-00Liwb; Mon, 29 Oct 2018 00:57:54 +0100 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Ma2U7-1g03yw41pH-00Liwb; Mon, 29 Oct 2018 00:57:54 +0100 In-Reply-To: <87tvl5653j.fsf@portable.galex-713.eu> (Alexandre Garreau's message of "Mon, 29 Oct 2018 00:09:36 +0100") X-Provags-ID: V03:K1:rV695nd9PzzkgyrbIkGON9ZkZ/fV43hK4JGjid/T7aVFTFvI2t0 vhhlqhk50FopxhoetksejxcKj/6BznpO/kOLNGmB7ys9ulgTcYIJ00R1HXLTVlmxZ5gAz8R ujEzW4W2yMXKBSKhX9UIcMcZddeO1AhFGr1PzQjfbg2nq/tTHq0AtRUITBuDIN1sLvIR9Wc 6CQ7RTV6ew1tNJNBLkpSw== X-UI-Out-Filterresults: notjunk:1;V01:K0:eZu/2lik7dk=:O9Gk+2OySpoTSocuizTcIj ORGzXYsbWURoFfiZ0G/qXilsvrBceL+93nQruK81TA8vNBcz55mmGt5iR0scPHWgILdH3SWGL FIbQ/4qseKi9IQb7jevkyLc3Yh87t93TlngpZMWUjXZ7ZnRKlyzjMEm7LBpOCksCfE06TMiyQ NCfAFiE/zIdVhoXzq9CmNZu0LQC31gC3IkkOW8fF4pBfRpqJmZlF/s2CNOxXnk4OzsP55n8xf fpIpQRMm9nLjdvLBHTHB2g/nIFGv2O3Q42jHzEDK8hgWsSW4WK7pjfkzqLLX1NcggLAVXwPqi JfTKPO42jDIwJ+SzAWLcXxJ95vdYqhoh2XQCGl6oB6ag5WAUH1KPj/VSe+yo0qOagdDXSipjh HYseG6cdxEXcL3s6QKtZW2RCApii5Bb+kXoM0MQ7jK9q/Of/Phy7Oas7NhIHBHHyghPrfF9hU ffk4k7rzvu3RgwcXGOBL/jvnhcm+IRnNT5aWt4vKmk7HKw97rWwLbrkHuVWqR/7Zqxr6GRRXH AT/OTOMvHoV66eIBWOJNAhf+vqNq67ou7Og+Jta8JncYe++wHcJHSSiYoAo7H8bbzD1sYwHeD yeaGQuPKV/PFZWWYuR+jZSq5S0cT4DJj+fA0S41F2uYZjsCmDDUd0ax/Asa2/4zseL9q9tWLA 7IOl6hDqRFiTmiDVlUR8IqpvGWeeUgVSjmVpKpQd89ghcHYczBkRnatC1RLnXMhaYsY9Fj1jd Ip7k3wNP+bkSa0OG7/7LlqxAt26DFzb2VzL75Gj2p7DxWbDDr7Eavxjdnvll5Y2SYISEIwlD 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.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:230761 Archived-At: "Garreau, Alexandre" writes: > =E2=80=9C(var name)=E2=80=9D, as does racket and some common-lisp match/u= nify > implementations. And so to integrate with =E2=80=9C`=E2=80=9D: =E2=80=9C= ,(var name)=E2=80=9D doesn=E2=80=99t > disturb me, it is okay: will bind =E2=80=9Cname=E2=80=9D to something, pr= etty > straightforward. That would make totally sense to me. I often found it confusing that using a symbol which is already bound (outside of pcase) isn't turned into an equality test. Having an explicit `var' or `bind' for binding variables would be nice. > Beside lisp, all pattern matching language make their feature serve > one purpose: the pattern look like what the data should be. adding =E2=80= =9C`=E2=80=9D > and =E2=80=9C,=E2=80=9D destroy this feature, because the pattern no long= er looks like > what is matched. But with, for example, el-search, that suddenly looks very natural if you can, for example, transpose the first two arguments of all `foo' calls in your code with the rule. `(foo ,a ,b . ,rest) -> `(foo ,b ,a . ,rest) The pattern exactly looks like the matched data! Just with a different point of view. Using ``' is not what most people would naively use to implement destructuring, but I don't find it unnatural or not intuitive, no. The above pattern would look different if we would have to write it as `(foo ,(var a) ,(var b) . ,(var rest)) so the implicit binding feature of symbols also makes patterns much more readable in more complex cases, which is a big win. Michael.