From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Tue, 30 Oct 2018 16:30:05 -0700 Message-ID: <87lg6f6miq.fsf@ericabrahamsen.net> References: <83tvlcsnee.fsf@gnu.org> <86mur137n8.fsf@gmail.com> <20181029130132.GB4195@ACM> <20181029134722.GC4195@ACM> <87lg6gifnb.fsf@web.de> <87muqwxs7m.fsf@ericabrahamsen.net> <87in1kxry1.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1540942124 12921 195.159.176.226 (30 Oct 2018 23:28:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2018 23:28:44 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 31 00:28:40 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 1gHdR9-0003Cp-VS for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2018 00:28:40 +0100 Original-Received: from localhost ([::1]:56048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHdTG-0005Kb-5X for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 19:30:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHdT0-0005Jc-Re for emacs-devel@gnu.org; Tue, 30 Oct 2018 19:30:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHdSu-0006Id-Si for emacs-devel@gnu.org; Tue, 30 Oct 2018 19:30:34 -0400 Original-Received: from [195.159.176.226] (port=46549 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHdSf-00068L-5M for emacs-devel@gnu.org; Tue, 30 Oct 2018 19:30:22 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gHdQW-0002S3-R7 for emacs-devel@gnu.org; Wed, 31 Oct 2018 00:28:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:81TU+xCl9EzG8E93aJcTfiH1Oyk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 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:230859 Archived-At: Stefan Monnier writes: >> In fact, when you think about it, the "case" nature of pcase is pretty >> orthogonal to the "match/destructure" nature of pcase. If anything > > How do you suggest to split the two in cases like: > > (defun cconv-convert (form env extend) > (pcase form > (`(,(and letsym (or `let* `let)) ,binders . ,body) > ...) > > (`(,(and `(lambda . ,_) fun) . ,args) > ...) [...] >...))) > > That kind of use is the main motivation behind the design of pcase. > > Once you have this, you also trivially cover the `cl-case` uses and you > can easily make it handle the "destructuring" uses. > Splitting the two will just require more code to get less flexibility. Sure, it was just a little realization I had, probably nothing that should lead to an actual code change. What I imagined, for a moment there, were matching forms that would look like "(m ,(and `(lambda . ,_) fun))", or something, and then you could use that matching form in a cl-case clause, or a lambda argument, or a dolist variable name. Ie, confining the pattern matching/destructuring to a form, which could be used in the existing macros/functions like cl-case or dolist. I can be safely ignored! Eric