all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Arthur Miller <arthur.miller@live.com>
Cc: Adam Porter <adam@alphapapa.net>, "ams@gnu.org" <ams@gnu.org>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>,
	"philipk@posteo.net" <philipk@posteo.net>
Subject: RE: [External] : Re: cond* vs pcase
Date: Wed, 7 Feb 2024 17:14:45 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488C85CA08182599E74CEF2F3452@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <DU2PR02MB10109826F4143098CB12BBA1D96452@DU2PR02MB10109.eurprd02.prod.outlook.com>

> > Don't use a jackhammer to drive in a carpet
> > tack, if you have a tack hammer in your tool
> > belt.  (But sure, you can always use the
> > jackhammer if you really want.)
> 
> I think it is more important to be consistent and
> choose one form than many different if possible.

The jackhammer is always "possible".  That doesn't
mean that always using it is the best way to help
human readers of the source code.

> This is a discussion like should I choose setq
> vs setf.

In the abstract, it is.  But the question isn't
abstract.  This is about coding style.  There's
no documented Elisp coding guideline about this, 
so it comes down to personal preference/style.

> Prefering pcase over cl-case, mean you have one
> place to lookup the documentation, one "special
> form" to learn, and so for your users too.

When the "One Way" results in overly complicated
source code it can become an obstacle.

Let a hundred flowers bloom.  You code your way
and I'll code mine. ;-)

I'm the main, maybe the only, reader of my code.

I use `if', `and', `when', etc., following the
convention I related.  I do that _so that I_ can 
more easily  read and understand my own code 
(sometimes years later).  I do that for the same 
reason that I sometimes add a comment with the
reasons behind some bit of code.

It's about human communication.

> It would be much better to have one function
> that let us pass in comparison operator, say
> like this:
> (member element list &optional test-function)

I agree.  It would be good to have that (as in
Common Lisp), and I've said so multiple times.

That doesn't mean we should remove `memq'.
And even if `memq' didn't exist, that wouldn't
be a great argument against adding a `memq'.

> I think it is more of peep-hole optimizing.

Not at all.  It's _not about performance_.
Dunno why people don't get that.  It's about
human communication: code writer/reader.
Just like comments and API doc.

> "Signalling" something to someone by carefully
> crafting use of cl-case vs. pcase sounds like a
> lot of cognitive load on all involved parties

No - the opposite.  And no one's required
to be sensitive to such nuances.

*IF* you know about the convention regarding
when to use `if', `and', `when', `cond',...
*THEN* you can immediately tell (even feel)
what's going on.  This is as natural to
code writers and readers as writing/reading
(car foo) or (let...).

*IF* you're unaware of, or not used to, that
convention, *THEN* you just miss out on that
immediate "intuition"/understanding of what's
going on.  You're not bothered at all.

But yes, you at least need to know what each
of `if', etc. does.  That's really not hard.
It's not hard to learn what `case' does.

> You are basically saying that we should use a
> high-level construct that helps us structure
> our programs according to their implementation
> not for their higher-level feature of singaling
> intention of our code.

I'm absolutely NOT saying that.  I'm saying that
communicating the intention of the code to human
readers is important.



  parent reply	other threads:[~2024-02-07 17:14 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 [this message]
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
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=SJ0PR10MB5488C85CA08182599E74CEF2F3452@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=adam@alphapapa.net \
    --cc=ams@gnu.org \
    --cc=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    --cc=philipk@posteo.net \
    /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.