[Top][All Lists]

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

Re: pcase and the unpopular backquote pattern

From: Clément Pit-Claudel
Subject: Re: pcase and the unpopular backquote pattern
Date: Wed, 20 Mar 2019 17:40:34 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 2019-03-20 16:57, Michael Heerdegen wrote:
> Given that backquote patterns are used mainly for lists, the suggested
> list and list* patterns, analogue to functions list and cl-list*, are
> not much less powerful, while their syntax and semantics can be
> explained without using recursion.  One disadvantage is that when you
> want to destructure nested lists you need to use nested "list" patterns.
> I guess for some people that would still be easier to read.  Another
> disadvantage would be that we would add completely redundant patterns -
> but I don't really see a problem here when it would improve readability
> for people.  

FWIW, I like the backquote pattern :) I don't think I would use this new form, 
but I don't think it would hurt either (except maybe when people find out that 
it breaks in old Emacsen).  Also, it would be one more thing to learn when 
learning pcase.

> With list* the definition would look like
> (pcase-defmacro car (pat)
>   `(list* ,pat _))
> while without you would need to write it as
> (pcase-defmacro car (pat)
>   `(,'\` ((,'\, ,pat) . (,'\, _))))
> Not something one needs to do often, but when you need to do that, this
> ,'\, salad is a pain.

Do you actually need that salad? Isn't the following enough?

(pcase-defmacro car (pat)
  `(\` ((\, ,pat) . (\, _))))

reply via email to

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