From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: Leo Liu <sdl.web@gmail.com>, 20268@debbugs.gnu.org
Subject: bug#20268: 25.0.50; pcase-lambda broken
Date: Wed, 08 Apr 2015 15:25:36 -0400 [thread overview]
Message-ID: <jwviod6pgvs.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <CAArVCkQsn7eQ4Ffag3a-xf3JDyP6OTEfw42eNSqgq+2AKeZKWA@mail.gmail.com> (Philipp Stephani's message of "Wed, 08 Apr 2015 15:08:36 +0000")
> Why not raise an error instead if there is no match
That would be an acceptable semantics, yes. I happen to dislike it
because of the performance cost, where in most use-cases you know the
pattern will match and just want to replace a bunch of car/cdr/aref with
a single pattern.
I.e. the code you'd have written without pcase-let would have been
(let ((a (foo))
(b (car foo))
(c (nth 2 foo)))
which would naturally turn into a pattern like `(,b ,_ ,c)
but if you want to signal an error when the pattern fails to match, then
you get 3 additional consp tests plus a null test, at which point the
performance impact can become noticeable. You can get rid of the null
test with a pattern like `(,b ,_ ,c . ,_) but you can't get rid of the
3 consp tests.
Stefan
next prev parent reply other threads:[~2015-04-08 19:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 7:42 bug#20268: 25.0.50; pcase-lambda broken Leo Liu
2015-04-08 1:01 ` Leo Liu
2015-04-08 14:35 ` Stefan Monnier
2015-04-08 2:14 ` Stefan Monnier
2015-04-08 13:22 ` Andy Moreton
2015-04-08 15:08 ` Philipp Stephani
2015-04-08 19:25 ` Stefan Monnier [this message]
2015-04-08 20:31 ` Drew Adams
2015-04-08 21:29 ` Stefan Monnier
2015-04-08 22:21 ` Drew Adams
2022-02-08 7:52 ` Lars Ingebrigtsen
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=jwviod6pgvs.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=20268@debbugs.gnu.org \
--cc=p.stephani2@gmail.com \
--cc=sdl.web@gmail.com \
/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.