From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Tue, 30 Oct 2018 09:07:35 -0400 Message-ID: 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 1540904813 25154 195.159.176.226 (30 Oct 2018 13:06:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2018 13:06:53 +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 Tue Oct 30 14:06:49 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 1gHTjN-0006TQ-9s for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 14:06:49 +0100 Original-Received: from localhost ([::1]:53169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHTlT-0007aJ-Gs for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 09:08:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHTkX-0007a4-9c for emacs-devel@gnu.org; Tue, 30 Oct 2018 09:08:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHTkH-0000Hy-MX for emacs-devel@gnu.org; Tue, 30 Oct 2018 09:07:54 -0400 Original-Received: from [195.159.176.226] (port=56289 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHTkH-0000Gi-EC for emacs-devel@gnu.org; Tue, 30 Oct 2018 09:07:45 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gHTi6-0004tV-TR for emacs-devel@gnu.org; Tue, 30 Oct 2018 14:05:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 65 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:XzfJDvO4fB8cbyEBlkplKJUOcJ0= 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:230823 Archived-At: > 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) ...) (`(cond . ,cond-forms) ...) (`(function (lambda ,args . ,body) . ,_) ...) (`(internal-make-closure . ,_) ...) (`(quote . ,_) form) (`(function . ,_) form) (`(,(and sym (or `defconst `defvar)) ,definedsymbol . ,forms) ...) ((and `(condition-case ,var ,protected-form . ,handlers) (guard byte-compile--use-old-handlers)) ...) (`(condition-case ,var ,protected-form . ,handlers) ...) (`(,(and head (or (and `catch (guard byte-compile--use-old-handlers)) `unwind-protect)) ,form . ,body) ...) (`(setq . ,forms) ...) (`(,(and (or `funcall `apply) callsym) ,fun . ,args) ...) (`(interactive . ,forms) ...) (`(declare . ,_) form) (`(,func . ,forms) ...) (_ ...))) 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. Stefan