all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: pcase and the unpopular backquote pattern
Date: Wed, 20 Mar 2019 17:40:34 -0400	[thread overview]
Message-ID: <1a0cabb6-17de-54f5-12c4-f526a607a3a4@gmail.com> (raw)
In-Reply-To: <871s31s1qy.fsf@web.de>

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	other threads:[~2019-03-20 21:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 20:57 pcase and the unpopular backquote pattern Michael Heerdegen
2019-03-20 21:40 ` Clément Pit-Claudel [this message]
2019-03-20 22:05   ` Michael Heerdegen

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=1a0cabb6-17de-54f5-12c4-f526a607a3a4@gmail.com \
    --to=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.