From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Alfred M. Szmidt" Newsgroups: gmane.emacs.devel Subject: Re: Code for cond* Date: Sun, 25 Feb 2024 12:46:05 -0500 Message-ID: References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29907"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, rms@gnu.org, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Feb 25 18:46:52 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1reIaR-0007aF-NI for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Feb 2024 18:46:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reIZv-0005B4-K4; Sun, 25 Feb 2024 12:46:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reIZo-0005AU-KF for emacs-devel@gnu.org; Sun, 25 Feb 2024 12:46:14 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reIZn-0000JZ-6T; Sun, 25 Feb 2024 12:46:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=dWYweW6iwq/WU7DflNF54nhHhQ+TPTS8JdFfQ5PwSmM=; b=f1Oo2Q7id8sx ZwJYMCzslDdj6QhZK+GHSOWxr68XWDPXcaDPPsFb1wT62FyHYj9RLi9r4WH6sPp3BGThh1Oq8Rhwa 9AA5IO9o+iLlsMiYM2NrRFe/TmOXeV2wgFidCLCMGHQDUVv2cNb8guXzCXA2bNNRTlcSHPh4pG7iF ldRpT/Trn4V4nj69h/fj9QFnWNtWW6We9TKgP6q0E7UFAjU9X63Wr4ejEL827qTokRLjfcixNHQlj jsbNPRq5Sw3frQiMTqLcXWUhVEox0zuHjsjXkCEMPUNo9/l0W5dB8sWTK2jodwbEBN3cak1XirsSz dcqANjYRonQ4kewJ0C67Qg==; Original-Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1reIZh-0000Z1-56; Sun, 25 Feb 2024 12:46:05 -0500 In-Reply-To: (message from Alan Mackenzie on Sun, 25 Feb 2024 17:22:20 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316536 Archived-At: Hello, Stefan. On Sun, Feb 25, 2024 at 10:38:46 -0500, Stefan Monnier wrote: > > On a slightly different topic, when will cond* be added/commited to > > GNU Emacs? Seeing that how cond* works, and documentation has > > slightly materialized, it would be good to get some milage. I agree. > FWIW, I'm opposed to adding it without first unifying the Pcase and > `match*` pattern languages (including making sure that third party > packages which define their own patterns don't need to define them > separately for `pcase` and for `match*`). > [ It's trivial to do by making `match*` reuse the Pcase machinery, so > there is no serious obstacle for that. ] I hope that cond* won't be written on top of pcase. The pcase machinery is almost entirely undocumented (and even the "almost" might be an exaggeration), and that doesn't look like changing any time soon. Debugging pcase itself, or a backtrace involving one of its expansions are thus difficult unpleasant tasks. (I speak from experience.) I'm sitting on the fence on this (since I don't have to bother with the complicated expansions from pcase) -- but from a quick glance, the code for cond* is much easier to grok than pcase, for similar reasons above but also just how the code is written. cond* looks like being better on the first point, and might well be better on the second. Those putative advantages would be lost by basing cond*'s implementation on pcase. Since cond* is much easier to understand, I hope that in a few years the usages of pcase will vaniahs slowly but surely .. and maybe even that that pcase could be rewritten using cond*.