all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Alfred M. Szmidt" <ams@gnu.org>
To: Arthur Miller <arthur.miller@live.com>
Cc: yuri.v.khan@gmail.com, philipk@posteo.net, emacs-devel@gnu.org
Subject: Re: cond* vs pcase
Date: Wed, 07 Feb 2024 14:12:50 -0500	[thread overview]
Message-ID: <E1rXnLm-0006Z9-4h@fencepost.gnu.org> (raw)
In-Reply-To: <DU2PR02MB1010920120BA262F14ECC46E496452@DU2PR02MB10109.eurprd02.prod.outlook.com> (message from Arthur Miller on Wed, 07 Feb 2024 19:36:56 +0100)

   >    I am not sure if Alfred meant that in his first message, perhaps he did, but
   >    Drew seems to be more in line with that thinking. At least I understand him so.
   >
   > I'm not alluding to any specific design principle, the core issue at
   > hand is communicating with the person reading the code.

   Yes, that is how I understand you; but I'll answer same as to Drew; I don't
   agree that this is the best way of expressing the intention.

   Both pcase and cl-case in this particular simple context I have posted, express
   the intention equally well. [...]

We disagree to the point that there cannot be any agreement on the
topic, they do not express the same intent, just like a cond and
explicit (eql .. 'foo) do not express the same intent as using 'case';
they maybe do the same thing, but there is more about intent than
that.

As for tangents of optimizations, I'm not going to discuss them at
all.

   It is rather that you are aware of the details of cl-case and pcase
   and understand that the pcase is more powerful and can express more
   powerful constructs. However just that fact that it is more
   powerful, does not mandate use of "simpler" construct. As Adam
   illustrated, in this particular scenario, cond, cl-case and pcase
   expressed equally well the intention. The runtime cost is about the
   same too; so I don't think the implementation deatails should guide
   the decision. That seems to me like some sort of premature
   optimization, peep-hole optimization of intentions. I am not sure
   how to express myself here :).

   > The reason why we have ASSOC, ASSQ, ... are because they make it

   I am not sure if the reason is the clarity. I think we have, with all right,
   gone away from abbrevs and accronys such as "assq" or "memql" in function and
   variable names to more self-documenting code. Those functions are historical
   artefacts in my eyes.

These functions are integral parts of Lisp, to call them "historical
artefacts" is to not understand or care to understand the language.  

   > _clear_, _easy_ to understand code and to _use_.  A generic version is
   > not as easy to understand, or use.  Which is also a reason why
   > keywords are generally eskewed in Emacs Lisp.

   Is this not clear and understandable:

   (member elt list #'eql)
   (memeber elt list :test 'eql)

You missed a crucial part: to use.  Writing code is also important.
But no, I do not find those clear at all, you have more symbols to
read, specially when comparing against common types like integers, or
symbols.  You have the question of _why_ did the writer use that exact
form instead of already, well known, well documented, functions like
memql.  So under no cirucmstance does the above mean clear or
understandable, rather it raises more questions.

   Can we be more explicit in communication the intention which test funciton to
   use, if communicating exactly that intention is really important.

   Approoos nameing and historical artefacts, I read once an interview with Ken
   Thompson; I don't remember on which site, so I don't have the link, but they
   were asking him a bit about Unix design and a bit about C language amongst other
   things. On the question if he regret anything abotu Unix design, he said, if he
   regret he used "creat" instead of "create" as the name for the syscall.

I fail to see the point? Would you prefer mem-eql / member-eqal over
memql? They would do the same thing, which isn't the case comparing
pcase to case, cond to cond*, ... 



  reply	other threads:[~2024-02-07 19:12 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 14:30 cond* vs pcase Arthur Miller
2024-02-05 15:13 ` Eli Zaretskii
2024-02-05 16:06 ` Alfred M. Szmidt
2024-02-05 18:39   ` Philip Kaludercic
2024-02-06 12:30     ` Arthur Miller
2024-02-06 16:17     ` Alfred M. Szmidt
2024-02-06 16:35       ` [External] : " Drew Adams
2024-02-06 16:50       ` Philip Kaludercic
2024-02-06 17:27         ` Alfred M. Szmidt
2024-02-06 18:57           ` Philip Kaludercic
2024-02-06 19:04             ` Alfred M. Szmidt
2024-02-06 19:39               ` Philip Kaludercic
2024-02-06 23:17                 ` [External] : " Drew Adams
2024-02-06 19:12             ` Drew Adams
2024-02-06 20:08               ` Adam Porter
2024-02-06 23:32                 ` Drew Adams
2024-02-07 13:14                   ` Arthur Miller
2024-02-07 13:43                     ` Po Lu
2024-02-07 17:09                       ` Drew Adams
2024-02-07 17:44                       ` Tomas Hlavaty
2024-02-09  3:52                         ` Richard Stallman
2024-02-07 18:00                       ` Arthur Miller
2024-02-07 18:22                         ` Alfred M. Szmidt
2024-02-08  1:55                           ` Po Lu
2024-02-08  2:49                             ` Philip Kaludercic
2024-02-08  3:36                               ` Po Lu
2024-02-08  7:04                             ` Eli Zaretskii
2024-02-08 17:01                               ` Alfred M. Szmidt
2024-02-08 17:01                             ` Alfred M. Szmidt
2024-02-09  1:30                               ` Po Lu
2024-02-08  5:01                         ` Po Lu
     [not found]                           ` <DU2PR02MB10109B7AC39F995BFE266EF5396442@DU2PR02MB10109.eurprd02.prod.outlook.com>
2024-02-08  7:36                             ` Sv: " Arthur Miller
2024-02-12 21:39                       ` Stefan Monnier via Emacs development discussions.
2024-02-07 17:14                     ` Drew Adams
2024-02-07  5:32             ` Yuri Khan
2024-02-07 12:43               ` Arthur Miller
2024-02-07 17:41                 ` Alfred M. Szmidt
2024-02-07 18:36                   ` Arthur Miller
2024-02-07 19:12                     ` Alfred M. Szmidt [this message]
2024-02-07 21:20                       ` Arthur Miller
2024-02-06 17:29         ` [External] : " Drew Adams
2024-02-06 17:41           ` Alfred M. Szmidt
2024-02-06 17:50         ` Thierry Volpiatto
2024-02-06 19:04           ` Alfred M. Szmidt
2024-02-07 15:03           ` Barry Fishman
2024-02-07 17:22             ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1rXnLm-0006Z9-4h@fencepost.gnu.org \
    --to=ams@gnu.org \
    --cc=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    --cc=philipk@posteo.net \
    --cc=yuri.v.khan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.