From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Nic Ferrier <nferrier@ferrier.me.uk>
Cc: Alan Mackenzie <acm@muc.de>,
Phillip Lord <phillip.lord@newcastle.ac.uk>,
emacs-devel@gnu.org
Subject: Re: A protest against pcase, pcase-let, pcase-let*
Date: Wed, 01 Apr 2015 09:53:20 -0400 [thread overview]
Message-ID: <jwvtwx02cqr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87k2xw12d4.fsf@ferrier.me.uk> (Nic Ferrier's message of "Wed, 01 Apr 2015 13:04:23 +0100")
> There are much better, more lisp idiomatic, libs for doing pattern
> matching which pcase should give way to imo.
> Shadchen for example.
I don't see much difference. AFAICT if there's a particular pattern of
shadchen you like, you/we can add it to pcase with `pcase-defmacro' and
IIUC both sets of patterns are perfectly compatible (and very similar
in spirit).
You can also add any of pcase's patterns to shadchen via its
defpattern construct, AFAICT).
It differs in implementation technique, tho, since AFAICT in shadchen
(match X
((cons 1 a) (foo1))
((cons 2 a) (foo2)))
will tests `listp' twice and will extract the car of X twice (i.e. it
does not optimize the second branch based on the knowledge of how the
first branch's pattern failed to match).
I guess the main difference you'll see is that shadchen supports
backquote via `bq' and `uq' rather than via ` and , so
(pcase X
(`(1 . ,a) (foo1))
(`(2 . ,a) (foo2)))
turns into
(match X
((bq (1 (uq a))) (foo1))
((bq (2 (uq a))) (foo2)))
which is so hideous that noone will ever use it. IIUC you don't like
the backquote syntax in patterns, so shadchen making it even more
hideous than it already is suits you better.
Stefan
next prev parent reply other threads:[~2015-04-01 13:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 18:00 A protest against pcase, pcase-let, pcase-let* Alan Mackenzie
2015-03-31 18:29 ` John Wiegley
2015-04-18 1:47 ` Ted Zlatanov
2015-03-31 19:25 ` Dmitry Gutov
2015-04-01 7:46 ` Daniel Colascione
2015-04-01 9:59 ` Phillip Lord
2015-04-01 12:04 ` Nic Ferrier
2015-04-01 12:16 ` Dmitry Gutov
2015-04-01 13:53 ` Stefan Monnier [this message]
2015-04-02 7:19 ` Richard Stallman
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=jwvtwx02cqr.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=nferrier@ferrier.me.uk \
--cc=phillip.lord@newcastle.ac.uk \
/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.