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: pcase-if-let? Date: Thu, 29 Mar 2018 00:53:29 -0400 Message-ID: References: <871sg3eqi5.fsf@web.de> <0e8139b0-b59c-1d7e-29db-66170858f8ca@lanl.gov> <87woxvd947.fsf@web.de> <87605filw6.fsf@web.de> <60dc117a-7ee2-42d2-acbc-49dae9ec6ae1@default> <871sg3ijgf.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1522299138 26894 195.159.176.226 (29 Mar 2018 04:52:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 29 Mar 2018 04:52:18 +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 Thu Mar 29 06:52:14 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 1f1PXq-0006w1-0L for ged-emacs-devel@m.gmane.org; Thu, 29 Mar 2018 06:52:14 +0200 Original-Received: from localhost ([::1]:46872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1PZt-0001s8-Kd for ged-emacs-devel@m.gmane.org; Thu, 29 Mar 2018 00:54:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1PZJ-0001ro-2u for emacs-devel@gnu.org; Thu, 29 Mar 2018 00:53:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1PZE-0005TE-5X for emacs-devel@gnu.org; Thu, 29 Mar 2018 00:53:45 -0400 Original-Received: from [195.159.176.226] (port=58474 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f1PZD-0005SU-UK for emacs-devel@gnu.org; Thu, 29 Mar 2018 00:53:40 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1f1PX5-00066j-2e for emacs-devel@gnu.org; Thu, 29 Mar 2018 06:51:27 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 25 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:a07LKLih+KxDCh4MQuuCqPfpZN8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] 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:224137 Archived-At: > Yes, your are right with everything, the names are nonsense. I guess we > are still in some kind of intermediate state - AFAIK Stefan hopes to > integrate the pcase stuff more into Emacs innards some day. Dealing > with these wide problems is not what I want to do here. For now, I just > want to be consistent with the existing naming scheme. FWIW, I'm a bit worried about this case: it's not like this pcase-if is a "pcase version of some existing construct", so if we ever want to get rid of the "pcase-" prefix on it, we'll have to invent a new name for it. IOW it's different from pcase-let and pcase-dolist which are designed to be "replacements" for let/dolist. Stefan PS: Regarding the "unorthodox" shape of the pcase construct, you could generate an expression of the form (pcase (list E1 E2 ...) ((list P1 P2 ...) THEN) (_ ELSE)). It would be a good opportunity to try and fix pcase so that it generates efficient code for such uses (i.e. it shouldn't build the list only to then check it). There are already uses of pcase that would benefit from it, typically for smie-rules-function where we often do (pcase (cons kind token) ...).