From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Madhu Newsgroups: gmane.emacs.devel Subject: Re: [External] : Re: Code for cond* Date: Thu, 01 Feb 2024 14:26:40 +0530 Message-ID: References: <1AD5807F-91F7-4B92-BCB0-D0FEA904A75D@gmail.com> 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="24087"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Cancel-Lock: sha1:mOK7+OK7KnE5AuVweKDwaFlFhvo= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 01 11:40:32 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 1rVUUh-00063M-AN for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Feb 2024 11:40:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVUUD-0008HZ-RK; Thu, 01 Feb 2024 05:40:01 -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 1rVSsJ-000493-4y for emacs-devel@gnu.org; Thu, 01 Feb 2024 03:56:47 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVSsF-00030E-VL for emacs-devel@gnu.org; Thu, 01 Feb 2024 03:56:46 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rVSsE-0008TX-2q for emacs-devel@gnu.org; Thu, 01 Feb 2024 09:56:42 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 01 Feb 2024 05:40:00 -0500 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:315699 Archived-At: * Drew Adams : Wrote on Wed, 24 Jan 2024 16:30:01 +0000: [JDS?] >> But oddly enough, this thread discussing its potential >> replacement has given me the key insight — “imagine >> running list interpolation backwards”. With that mental >> model, I find I can now read pcase forms much more easily >> and confidently. >> >> A short introductory paragraph in the elisp pcase >> documentation which explains this approach to its novel >> syntax would have gone a long way for me. > > Indeed, this is the place for the pcase doc to _start_. > Unfortunately, the doc doesn't do that. "pcase" assumes that its users are already familiar with the use of pcase from the other languages where they have used similar control flow constructs, and it is intuitively obvious to them. I believe this is how it has worked, it is extremely effective in attracting programmers of the a certain "same mindset" to come to emacs, and puts a high barrier of entry on programmers who do not belong to that mindset, thereby subtly shaping the programmer demographic which eventually directs the future of emacs. > There _is_ a pcase doc _subnode_ that covers such > pattern-matching destructuring, but this should > be up-front. It's _the most important_ feature > to point out and make clear. It's the easiest to > grasp and the most useful for understanding the > rest. > > The subnode covering destructuring is the very > _last_ one, "Destructuring with pcase Patterns": > > https://www.gnu.org/software/emacs/manual/html_node/elisp/Destructuring-with-pcase-Patterns.html > ___ > > I specifically suggested such doc improvements > in an enhancement request, but they were > unfortunately summarily dismissed just a few > minutes after the suggestion was received: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68029#13 > > About this I said, e.g.: > > Such advantages should start with DESTRUCTURING - > the ONE thing you _don't_ have built-in with the > existing Elisp binding forms or conditional forms. > > Start with a simple destructuring example: > `case'-like, but with destructuring. That's my > advice. > > Destructuring is the easiest & most powerful `pcase' > feature to introduce, and it's not really shown. > It's glossed over, at best. Show beginners that, to > start with. > > In a nutshell, `pase-let' vs `let' is really the > place to start. _Then_ add conditional control into > the mix. > > [The current top-level, beginning `pcase' doc is] as > if someone only tried to explain away some of what > is particularly confusing about `pcase', instead of > teaching the strengths of `pcase'.