From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Instead of pcase Date: Fri, 01 Dec 2023 13:52:21 +0200 Message-ID: <83msuu9m2y.fsf@gnu.org> References: <87fs169mjj.fsf@posteo.net> <093f11a1-57c2-5e56-d39b-26fef1c67cbb@gutov.dev> <25942.25061.217864.329049@retriever.mtv.corp.google.com> <87zfzdcz6z.fsf@posteo.net> <763f067b-4ca9-1eba-9f3c-424c38589e9c@gutov.dev> <83fs0navpj.fsf@gnu.org> <838r6ebfhw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10781"; mail-complaints-to="usenet@ciao.gmane.io" Cc: owinebar@gmail.com, rms@gnu.org, dmitry@gutov.dev, philipk@posteo.net, emacs-devel@gnu.org To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 01 12:52:56 2023 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 1r924l-0002bA-Q2 for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Dec 2023 12:52:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r924R-00080K-2B; Fri, 01 Dec 2023 06:52:35 -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 1r924P-00080A-Dr for emacs-devel@gnu.org; Fri, 01 Dec 2023 06:52:33 -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 1r924O-0004WE-0s; Fri, 01 Dec 2023 06:52:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=otp/BzJK1eFt1J29rgC2uBZQJBpH8zih+j7XzXLstW0=; b=p0PbKXFby0XmXpB7a1IB PcEH2IYHtek7Buhc5MsH6WUkUW/GgpbBTBx8lG//OBV8GWeBKe1uqmMiks4dtms2VazEw50K554Dp VLP9MfcLLuvbrLf0Iw6A4jp0JIwzb+lpkwlMOsSKXE0XPZ7ck81NnDytjf4HOJUOUVrm3JukpHiX7 FsdsjnEaqhwACl/KYz2oUSKnN3mBh75TA85ZTA4/wGkb5J3kl8eog/IpeqZXxakr6ODClDFDQuYEE aLlrDbNk5QJsFjGNPb64PpeSqlS6cRwka9Fw4GdrWtcwevrrbBjw/yTJ4xlGU6cIfoJT6Atvra04e aLxAmbFTFPTV2A==; In-Reply-To: (message from =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= on Fri, 1 Dec 2023 10:02:37 +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:313437 Archived-At: > From: João Távora > Date: Fri, 1 Dec 2023 10:02:37 +0000 > Cc: owinebar@gmail.com, rms@gnu.org, dmitry@gutov.dev, philipk@posteo.net, > emacs-devel@gnu.org > > On Fri, Dec 1, 2023 at 6:31 AM Eli Zaretskii wrote: > > So, in these emails, I'm trying to explain to you how to change your > view of these pcase constructs in a constructive way This is a misunderstanding: I'm not expressing _my_ views. I'm expressing the views of someone who bumps into this code the first or the second time, and/or didn't yet have the advantage of someone giving them "a piece of insight" that caused you to change your mind. IOW, I'm expressing _your_ views before you changed your mind. In Emacs development and maintenance, being able to look at stuff from the POV of an innocent user or Lisp programmer is sometimes required to realize the true impact of some constructs and features. We cannot regard that only from the height of our own knowledge and experience, which usually far surpass those of many Emacs users and programmers. > You take a backtick-starting construct with as many scary periods > things as you can find and then, say > > `(,foo . (,bar . ,baz)) > > And then ask yourself: "what kind of list does this build if I just > let-bind foo, bar and baz to 42?". And then you answer yourself > "Why, it's the improper list (42 42 . 42) made up of just two cons > cells and 3 fixnums!". So _that's_ the kind of list that can be > destructured with the pcase expression. > > This solves the reading problem. Now the writing problem. To author > new pcase patterns one uses more or less the same process. One again > leans on one's existing knowledge of how the list structure would be > expressed with backtick-and-quote. So once you know the list > structure in your mind you write it as a backtick-and-quote expression, > just as if you were going to craft that list (though you aren't of > course). Then once you're happy with your expression, you may take it > and you put it in one of the BINDINGS left-hand part of a 'let'. > Then you rename that 'let' to 'pcase-let' and away you go! If this is that easy, then why do we need no less than 120 lines to describe pcase in the doc string, and no less than 600 lines to document its features in the ELisp manual? You and others seem to assume that I'm against pcase, or that I'm attacking its syntax, or don't understand it. Andreas Schwab has even gone as far as lecture me on the basics of the Lisp reader and the syntax of Emacs Lisp, apparently under the assumption that I don't understand that. None of that is true. All I'm trying to say is that there _are_ inherent problems in the DSL whose knowledge is required to understand code written using pcase, and that you and others should recognize these inherent problems are real, even though you have overcome them, and anyone could overcome them given enough time and experience.