emacs-devel
[Top][All Lists]
Advanced

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

Re: Code for cond*


From: Stefan Monnier
Subject: Re: Code for cond*
Date: Sun, 25 Feb 2024 12:10:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>   > What makes you think so?
>   > I doubt you'd consider coders' confusion as a feature, so what makes you
>   > think people won't find it confusing (and/or get confused, even when
>   > they may not realize it's confusing)?
> It is less unnatural than the pcase patterns for the same things,
> such as `pred', so I think any confusion from it will be mild.

I for one find your syntax a lot more unnatural than the (pred
SYMBOL) syntax, so what is natural is in the eye of the beholder
(despite your use of "it is" which makes it sound like it's a plain
fact rather than an opinion).

The fact that a pattern like (< x y) will treat `y` as a reference to an
existing variable but `x` as the binding site for a new` x` variable is
what I find too risky.

That's why I suggest the use of "," as in (< ,x y) which makes the
difference more clear (and leans on the use of , in the backquote
patterns where it similarly indicates places where a new variable is
bound).

>       > Of course, there remains the question whether this usage should be
>       > the one that gets the privilege of not needing a dedicated
>       > "keyword", i.e. to allowing using it without the surrounding `pred`.
>
> I expect this to be frequent, so people will get used to it.
> Thus. the cost of learning it will be distributed across many uses,
> and users will appreciate the brevity often.

That's also what I thought about the `pcase` patterns.
Yet, 14 years alter, we still have regular threads about how its syntax
is impenetrable, so much so that you went through the trouble of
implementing a "replacement" (which ends up inventing the same wheel).
:-)


        Stefan




reply via email to

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