From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Instead of pcase Date: Fri, 01 Dec 2023 16:47:51 +0100 Message-ID: <87plzp53h4.fsf@web.de> 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> <87il5jgf1z.fsf@web.de> <83a5qubfud.fsf@gnu.org> Reply-To: Michael Heerdegen Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16918"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:qphFpUPbdoZYgyI8rKxdA+esrb0= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 01 16:48:50 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 1r95l3-00048T-Lm for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Dec 2023 16:48:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r95k4-0002YZ-D2; Fri, 01 Dec 2023 10:47:48 -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 1r95k2-0002YM-4k for emacs-devel@gnu.org; Fri, 01 Dec 2023 10:47:46 -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 1r95k0-0001ku-HC for emacs-devel@gnu.org; Fri, 01 Dec 2023 10:47:45 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1r95jx-0002Xm-CY for emacs-devel@gnu.org; Fri, 01 Dec 2023 16:47:41 +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: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, 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-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:313442 Archived-At: Eli Zaretskii writes: > > This is not a valid expression and will be rejected by the reader. > > Was it a typo or did you think this would be valid? > > It was taken from one of the posted examples, perhaps with a typo. > But that is not relevant. My question was meant sincerely. Did you try to understand the syntax? How? What was or is still unclear to you? > Are you saying pcase doesn't have > constructs like (`(SOMETHING...), or that SOMETHING doesn't use > periods in places where they are redundant in "normal" ELisp code? Redundant - no. May there be different redundant ways to express lists - yes. If you use a backquote pattern `SOMETHING in pcase, when SOMETHING should match a cons (lists are conses), then SOMETHING will typically be a cons. The dot reader syntax is the canonical read syntax for conses. This is not that weird. > IOW, these details are not the point, the point is something else > entirely, see below [...] > My point focuses on the problems this syntax causes to someone who > doesn't have intimate knowledge and a lot of practice with pcase. It is repeatedly used a wording like "magical", as if that was an argument. Ok, this syntax makes one first wonder how it has to be interpreted. Happened to me, too. But this (the wondering) takes only seconds. What happens after that? Have people then seriously tried to understand the syntax? Where and why did they fail? I heard nothing about that. Just a repetition that it looks "strange" or "magical" or that one would expect a different syntax. Given that cons cells and lists are fundamental building blocks of the whole language, I had hoped to hear more about why understanding this would be hard. Nobody did that concretely apart from Richard. And it might be the case that his rewrite will reuse the backquote syntax. > > As an alternative one can have a look at the docstring. > > It is a disadvantage if one needs to consult doc strings all the time > while reading code. And in this case, the doc string is quite long > and highly non-trivial (and rightfully so, since the DSL is a rather > complex one). This is, or should, not be the case. Sometimes one might need to recall the argument order of 'let' or 'app', but more when writing code. I don't ever need to consult the documentation of `pcase' when reading code, apart from the case when additional pcase macros are involved (like 'map'). And I don't have a good such a good memory for such things. And I use it only in rare circumstances, where possible I prefer `if', `cond', and `if-let'. > If one bumps into such constructs very frequently, then eventually one > will become familiarized with them. But if the frequency is low > enough, one could easily forget the details, and then one will need to > consult the documentation again the next time. What I want to say is that if you need to consult documentation of backquote syntax in pcase again and again, you might not have understood it entirely. This is my question: do people fail to understand the concept, or don't they even try? > Please don't underestimate these difficulties, even if you don't share > them. I still try to understand them. Michael.