From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: combining cond and let, to replace pcase. Date: Sun, 19 Nov 2023 14:52:31 +0100 Message-ID: <87pm053l5s.fsf@web.de> References: <878r6u3s7f.fsf@web.de> <831qcmklys.fsf@gnu.org> <87v89x3o19.fsf@web.de> <83v89xki0p.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="32604"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:QJI/3oCeM7VwOrrthQNFOSjuYjI= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 19 14:52:48 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 1r4iEC-0008Lp-C7 for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Nov 2023 14:52:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4iDu-0002Hz-S7; Sun, 19 Nov 2023 08:52:31 -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 1r4iDt-0002Hb-8I for emacs-devel@gnu.org; Sun, 19 Nov 2023 08:52:29 -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 1r4iDr-0003vn-NE for emacs-devel@gnu.org; Sun, 19 Nov 2023 08:52:29 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1r4iDp-0007r8-Qy for emacs-devel@gnu.org; Sun, 19 Nov 2023 14:52:25 +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.25, 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:312975 Archived-At: Eli Zaretskii writes: > So we agree. Then arguments about how easy pcase is for some are not > relevant, because this is not what this is about, right? It is a part of the picture. How many these "some" are is another part. And how harder it will become for those others to work with an alternative tool is again another part. And why is it always suggested that people not liking pcase are the norm and those understanding it well are the deviation from the norm? We don't know whether some different tool is actually easier to learn on average. And we won't find a fair solution if we leave out half of the people. > > This is an excellent analogy. Which one is the counterpart to `pcase'? > > `rx' or the string form? > > The string, of course. Interesting. `rx' is more similar to pcase in some regards - it's extensible with macro definitions (rx-defmacro), has descendants (even more macros: rx-let) and adds syntax to the language that is not Lisp. > It isn't only that. It is also that the obscure and subtle nature of > regexp strings makes it easy to make mistakes. Just look at the sheer > number of regexp mistakes uncovered in our code base by Mattias > EngdegÄrd during the last year. It isn't an accident. We have converters to convert between the two representations. Did we look at mistakes that are typical for `rx' forms? It would be trivial that we find less mistakes in `rx' forms when we only have a small number of them compared to string regexps. > > The amount of knowledge you need to remember, the amount of > > documentation you need to consult, is the same. > > The rx notation is easier to read and interpret, at least for some, > and I submit leads to fewer mistakes. Yes, for some. For me, too, actually. Whether it leads to fewer mistakes I don't know, both representations are really directly isomorphic in this case. > So no, I don't agree that it is "just the habit", and nothing else. Personally I hate it if I have to read string regexps. But I guess some of the pcase critics don't like `rx' and others don't like string regexps. It is also not trivial which of both leads to more programming errors, and why. It is not trivial that `pcase' is a larger hurdle than an alternative. I'm not convinced this is not "just the habit" - but there seems a lot of psychology involved here, too. Michael.