emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using "pcase" as part of names is inhelpful.


From: Stefan Monnier
Subject: Re: Using "pcase" as part of names is inhelpful.
Date: Mon, 11 Dec 2017 09:31:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]