all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using "pcase" as part of names is inhelpful.
@ 2017-12-09 22:00 Richard Stallman
  2017-12-09 22:35 ` John Wiegley
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Richard Stallman @ 2017-12-09 22:00 UTC (permalink / raw)
  To: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

The construct 'pcase' uses patterns to test and destructure
objects while selecting among various cases.

Now we are adding other constructs that use patterns to destructure
objects.  These constructs have nothing to do with selecting among
cases.  Thus, 'pcase' in their names makes for misleading names.
The only part of the name 'pcase' that refers to the use of
patterns is the letter 'p'.

Referring users to 'pcase' to understand the use of patterns is
unhelpful since 'pcase' includes conceptual complexity (about cases)
that isn't present in the new constructs.

We should give the new constructs names that fit them without a
distracting element.  What would be good new names?

We could use 'plet' and 'plambda'.  Or 'pattern-let' and 'pattern-lambda'.

We could follow the example of Common Lisp 'destructuring-bind', to
create 'destructuring-let' and 'destructuring-lambda'.

Let's mark the old names 'pcase-...' obsolete so that they won't build
up in Lisp code.
-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Skype: No way! See https://stallman.org/skype.html.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using "pcase" as part of names is inhelpful.
  2017-12-09 22:00 Using "pcase" as part of names is inhelpful Richard Stallman
@ 2017-12-09 22:35 ` John Wiegley
  2017-12-09 23:01   ` Paul Eggert
  2017-12-10 21:44   ` Richard Stallman
  2017-12-10  1:07 ` Robert Weiner
  2017-12-11 14:31 ` Stefan Monnier
  2 siblings, 2 replies; 7+ messages in thread
From: John Wiegley @ 2017-12-09 22:35 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel

>>>>> "RS" == Richard Stallman <rms@gnu.org> writes:

RS> We could use 'plet' and 'plambda'. Or 'pattern-let' and 'pattern-lambda'.

I prefer the latter two, and agree that pcase-let is inaccurately named.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using "pcase" as part of names is inhelpful.
  2017-12-09 22:35 ` John Wiegley
@ 2017-12-09 23:01   ` Paul Eggert
  2017-12-10 21:44   ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Paul Eggert @ 2017-12-09 23:01 UTC (permalink / raw)
  To: Richard Stallman, emacs-devel

On 12/09/2017 02:35 PM, John Wiegley wrote:
> RS> We could use 'plet' and 'plambda'. Or 'pattern-let' and 'pattern-lambda'.
>
> I prefer the latter two, and agree that pcase-let is inaccurately named.

Racket uses the names "match-let" and "match-lambda", which are clear 
and would save eyeballs a bit compared to "pattern-let" and 
"pattern-lambda".

https://docs.racket-lang.org/reference/match.html




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using "pcase" as part of names is inhelpful.
  2017-12-09 22:00 Using "pcase" as part of names is inhelpful Richard Stallman
  2017-12-09 22:35 ` John Wiegley
@ 2017-12-10  1:07 ` Robert Weiner
  2017-12-10 21:45   ` Richard Stallman
  2017-12-11 14:31 ` Stefan Monnier
  2 siblings, 1 reply; 7+ messages in thread
From: Robert Weiner @ 2017-12-10  1:07 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

On Sat, Dec 9, 2017 at 5:00 PM, Richard Stallman <rms@gnu.org> wrote:

>
> We could follow the example of Common Lisp 'destructuring-bind', to
> create 'destructuring-let' and 'destructuring-lambda'.
>

​I thought everyone would go for the above since there are
many Common Lisp constructs being used in third-party
Emacs packages nowadays.

Bob
​​

[-- Attachment #2: Type: text/html, Size: 1325 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using "pcase" as part of names is inhelpful.
  2017-12-09 22:35 ` John Wiegley
  2017-12-09 23:01   ` Paul Eggert
@ 2017-12-10 21:44   ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2017-12-10 21:44 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > RS> We could use 'plet' and 'plambda'. Or 'pattern-let' and 'pattern-lambda'.

  > I prefer the latter two, and agree that pcase-let is inaccurately named.

If they are unusual and obscure, 'pattern-...' are better.
If they are widely used and all Emacs Lisp programmers know about them,
'p...' are better.

  > Racket uses the names "match-let" and "match-lambda",

Those names are reasonable, too -- but they would not be similar
to 'pcase'.

Should we rename 'pcase' to 'match-case'?  In principle there is nothing
wrong with that.  But if we expect all these names to become everyday
Lisp usage, we'd be better off with 'p'.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Skype: No way! See https://stallman.org/skype.html.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using "pcase" as part of names is inhelpful.
  2017-12-10  1:07 ` Robert Weiner
@ 2017-12-10 21:45   ` Richard Stallman
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2017-12-10 21:45 UTC (permalink / raw)
  To: rswgnu; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

The disadvantage of 'destructuring-' is that it is so long.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Skype: No way! See https://stallman.org/skype.html.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using "pcase" as part of names is inhelpful.
  2017-12-09 22:00 Using "pcase" as part of names is inhelpful Richard Stallman
  2017-12-09 22:35 ` John Wiegley
  2017-12-10  1:07 ` Robert Weiner
@ 2017-12-11 14:31 ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2017-12-11 14:31 UTC (permalink / raw)
  To: emacs-devel

> Now we are adding other constructs that use patterns to destructure
> objects.  These constructs have nothing to do with selecting among
> cases.  Thus, 'pcase' in their names makes for misleading names.

Indeed, their "pcase-" is the name of the package but it can be confused
with the name of the `pcase` macro.

> We should give the new constructs names that fit them without a
> distracting element.  What would be good new names?
> We could use 'plet' and 'plambda'.  Or 'pattern-let' and 'pattern-lambda'.

For pcase-dolist, there's little doubt in my mind that we should call it
`dolist`.  For pcase-let, I'd also like to call it `let`, tho there are
some technical difficulties there (it would probably involve renaming
the current `let` special form and providing an initial "dummy"
definition of `let` as an alias for that new name during bootstrap
until we get to the point where we can override it with pcase's
version).

OTOH I'm not so sure we want to rename pcase-lambda to `lambda` for
the simple reason that I'm not completely satisfied with `pcase-lambda`
and I don't see a way that would satisfy me without making it
"incompatible" with `lambda` (the main issue being that &optional and
&rest are themselves limited forms of pattern matching, so we'd have to
either add them to pcase patterns or find some other way to combine the
two).

Given that there are currently very few uses of pcase-lambda, I'm
pretty happy living with a suboptimal name like `pcase-lambda`.

> We could follow the example of Common Lisp 'destructuring-bind', to
> create 'destructuring-let' and 'destructuring-lambda'.

That would make it sound like it will use CL-style patterns rather than
pcase-style patterns.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-11 14:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-09 22:00 Using "pcase" as part of names is inhelpful Richard Stallman
2017-12-09 22:35 ` John Wiegley
2017-12-09 23:01   ` Paul Eggert
2017-12-10 21:44   ` Richard Stallman
2017-12-10  1:07 ` Robert Weiner
2017-12-10 21:45   ` Richard Stallman
2017-12-11 14:31 ` Stefan Monnier

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.