From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: Instead of pcase Date: Thu, 16 Nov 2023 10:22:12 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25088"; mail-complaints-to="usenet@ciao.gmane.io" To: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 16 19:22:59 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 1r3h10-0006Kw-RL for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Nov 2023 19:22:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3h0W-0007Z5-EH; Thu, 16 Nov 2023 13:22:28 -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 1r3h0P-0007Ya-0b for emacs-devel@gnu.org; Thu, 16 Nov 2023 13:22:22 -0500 Original-Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3h0M-0003Mw-Cu; Thu, 16 Nov 2023 13:22:19 -0500 Original-Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1cc0d0a0355so9496805ad.3; Thu, 16 Nov 2023 10:22:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700158936; x=1700763736; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=uSEao3h8jCRLzTuKrPOFXbXrC0x3eAWQPDw6A/PBeO0=; b=HdIILqbvMCMRuzHn36DjmPxE3KcvYHT3+Pz/FsrC/QmgNwTdMjcvGwNJAU/gm0yO6j /UTAHYE33mQXfTk/bV9/1BKAaZOf45uCAspKZr/0sT67fWkcn+fBJ7x/Sx4CQc1Xbh5d ow9aZKI9Y7YCna5Ohllj5xQPNWMzLXWYUbdVUU2Z3MGr+GOhNMYfOi7ZGeHLDJEFT7aX PVdEQHGzdo5NLMS9Kyb1/dI2NUFwhgU+x7g1vw9HDMc83MMqAvv8/8oEfPUB67tmaIIo Z/skLcWKrROA573Vre2660/yFffgPOVQfTTJjuApw4b0v8Wakq+sLpwyGvLarIoSw/MF eysw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700158936; x=1700763736; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uSEao3h8jCRLzTuKrPOFXbXrC0x3eAWQPDw6A/PBeO0=; b=qUVrsWe9kWjAP5SNxFgT2wOre1lmvytLh8Ch4+ov+zuybJb8i4DbC9DnYRCVHHZ0yg dXWGBvpy7UxmJP61BUdNRw92CbzBCA1vPxZJOjCCYxJ8T1SU0gGBBWyprpcT7ZONkDTY xG4HnKafUehz/2IDEmWL0wUe7XjagXULUmm62sYbuc+sKeZItd252sJ8EH52y0ojdyxQ hlBIlxUa/v8uG+QqJXmk5EriXhkVQXr4ryZp/T5poWyos58GYdQYZ+8ac1lNwAirqkq0 52EUrvslr02bol8VNCzFEyhKhtmRVUjDOBtAONCk6iPviTRAkWP1JJZsX+8d9sO13Zw+ 7jtA== X-Gm-Message-State: AOJu0YzG/8njzGlfbqaORjcwdDDd9GbFbfLJcb8Db8uJ0+euaQ0EYnLR 1tYUroxOwjx/Y9E1Z+TeGER6SVyoCd8= X-Google-Smtp-Source: AGHT+IGs96txgIiivc9LsmeGSpQPrUWalCtdhsbNKQftvdCl5d8WKOM/am6Oakgvq5YSn5QwCcb15g== X-Received: by 2002:a17:902:e744:b0:1cc:6e8f:c14d with SMTP id p4-20020a170902e74400b001cc6e8fc14dmr11378684plf.50.1700158935845; Thu, 16 Nov 2023 10:22:15 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id ix9-20020a170902f80900b001c74876f018sm9601074plb.18.2023.11.16.10.22.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Nov 2023 10:22:15 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:312821 Archived-At: On 11/15/2023 7:04 PM, Richard Stallman wrote: > Those of you who are fans of `pcase' may not recognize the cost it > imposes on the Emacs Lisp language. You paid that cost already, > perhaps a few years ago, and perhaps you enjoy each new language > construct you learn. Perhaps, for you, the more complexity of > features to be learned, the better. I'd like to offer a slightly different perspective here, as someone who only fairly recently became comfortable with Lisp (of any variety). I've used Emacs for a long time, but I found Lisp completely incomprehensible until just a couple of years ago. While getting started with Lisp isn't terribly complex, it's still quite a bit to learn, and it took a period where I was between jobs before I could dedicate the time I needed to get comfortable with writing Lisp. I encountered a lot of hurdles with Lisp along the way. The first one was extremely basic: I needed to get used to the style of indentation and develop an intuition for *reading* Lisp code, rather than slowly and laboriously translating it into a form I could understand more easily. The next hurdle was quoting. I still remember that one of my first patches to Emacs needed someone else to fix it in a followup because I messed up the quoting. The issues of quoting came up repeatedly for me as I encountered progressively more complex examples of quoting. This is where we get to 'pcase'. I'll agree that the upper limit on complex quoted forms in 'pcase' is very high. I've used 'pcase-defmacro' in one nontrivial case, and I found it very difficult to get right. *However*, 99% of the 'pcase' instances I've written or encountered are pretty simple for me to understand. Once I learned about 'pred' matcher and how to destructure via backquote patterns, it was mostly smooth sailing for me. Now, while I'd certainly say that I enjoy learning overall (or else I likely wouldn't have learned Lisp in the first place), I don't consider the complexity of a feature to be a positive. Instead, I prefer features that give me more power or better expressiveness. Often, that expressiveness comes at the cost of complexity under the hood (e.g. 'pcase-defmacro'), but that's not a positive to me in and of itself. Overall, 'pcase' is one of the parts of Elisp that I appreciate the most. Learning the basics of its mini-language took just a bit of reading. In addition to the docs, seeing examples helped: the first few times were a bit tricky to read, but I could usually understand what was happening, even if I couldn't (at the time) write my own 'pcase' code that worked. However, once I got the basics down, I quickly saw the benefits: I could combine a handful of basic tools to do bigger things, meaning I only need to know a small set of facts before I can tackle a complex task. This, to me, is the mark of a good language feature: I can compose it in ways that *multiply* the power of each (small, easy) bit. At a higher level, I'd say it's worth considering the audience we want to focus on. For veteran (Emacs) Lisp programmers, new additions like 'pcase' can increase the difficulty of reading new Elisp code: your prior mastery of the language isn't any good when you hit that "(pcase". However, many programmers today don't know Lisp, of any variety. For people like that, learning to contribute to Emacs means learning from the very beginning. Having gone through this, most of 'pcase' was very easy for me to pick up, and other parts of Elisp were much more challenging (it took me a long time to get comfortable with writing macros, which is also probably one of the reasons I found 'pcase-defmacro' to be so tricky). That said, it's true that every feature we add to Elisp increases the overall complexity because now there are more things to learn. However, in my opinion, the expressiveness of 'pcase' far outweighs this cost.