From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: A protest against pcase, pcase-let, pcase-let* Date: Wed, 01 Apr 2015 09:53:20 -0400 Message-ID: References: <20150331180029.GF2871@acm.fritz.box> <87d23ob247.fsf@newcastle.ac.uk> <87k2xw12d4.fsf@ferrier.me.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427896433 4799 80.91.229.3 (1 Apr 2015 13:53:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 Apr 2015 13:53:53 +0000 (UTC) Cc: Alan Mackenzie , Phillip Lord , emacs-devel@gnu.org To: Nic Ferrier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 01 15:53:37 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 1YdJ5L-000524-I6 for ged-emacs-devel@m.gmane.org; Wed, 01 Apr 2015 15:53:35 +0200 Original-Received: from localhost ([::1]:52836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdJ5L-0004iG-3d for ged-emacs-devel@m.gmane.org; Wed, 01 Apr 2015 09:53:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdJ5C-0004bS-83 for emacs-devel@gnu.org; Wed, 01 Apr 2015 09:53:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdJ58-0003b9-4E for emacs-devel@gnu.org; Wed, 01 Apr 2015 09:53:26 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:7888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdJ58-0003b2-1F for emacs-devel@gnu.org; Wed, 01 Apr 2015 09:53:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCwsOJhIUGA0kiBOiEYwDJD0MA4M+A4NwBKg7 X-IPAS-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCwsOJhIUGA0kiBOiEYwDJD0MA4M+A4NwBKg7 X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="115138972" Original-Received: from 65-110-216-75.cpe.pppoe.ca (HELO pastel.home) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Apr 2015 09:53:21 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 06C94EA0; Wed, 1 Apr 2015 09:53:21 -0400 (EDT) In-Reply-To: <87k2xw12d4.fsf@ferrier.me.uk> (Nic Ferrier's message of "Wed, 01 Apr 2015 13:04:23 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:184711 Archived-At: > There are much better, more lisp idiomatic, libs for doing pattern > matching which pcase should give way to imo. > Shadchen for example. I don't see much difference. AFAICT if there's a particular pattern of shadchen you like, you/we can add it to pcase with `pcase-defmacro' and IIUC both sets of patterns are perfectly compatible (and very similar in spirit). You can also add any of pcase's patterns to shadchen via its defpattern construct, AFAICT). It differs in implementation technique, tho, since AFAICT in shadchen (match X ((cons 1 a) (foo1)) ((cons 2 a) (foo2))) will tests `listp' twice and will extract the car of X twice (i.e. it does not optimize the second branch based on the knowledge of how the first branch's pattern failed to match). I guess the main difference you'll see is that shadchen supports backquote via `bq' and `uq' rather than via ` and , so (pcase X (`(1 . ,a) (foo1)) (`(2 . ,a) (foo2))) turns into (match X ((bq (1 (uq a))) (foo1)) ((bq (2 (uq a))) (foo2))) which is so hideous that noone will ever use it. IIUC you don't like the backquote syntax in patterns, so shadchen making it even more hideous than it already is suits you better. Stefan