unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: John Williams <jrw@google.com>, 14773@debbugs.gnu.org
Subject: bug#14773: 24.2; pcase
Date: Wed, 03 Jul 2013 18:53:38 +0200	[thread overview]
Message-ID: <87mwq3d1pp.fsf@web.de> (raw)
In-Reply-To: <jwv1u7gyoq9.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 03 Jul 2013 05:34:59 -0400")

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> > (require 'pcase)
> > (macroexpand
> >    '(pcase 1
> >       ((and (let var left) (guard var)) 'left)
> >       ((and (let var right) (guard var)) 'right)))
>
> > When I run this, the result I get is (let ((x 1)) (if (let* ((var left))
> > var) (let ((var left)) (quote left)) nil)).  Note that "right" doesn't
> > appear anywhere in the macro expansion!
>
> Since the second branch of your pcase is unreachable, I think it's OK
> for pcase to eliminate it.

Why is it unreachable?

(defvar left nil)
(defvar right t)

(pcase 1
  ((and (let var left) (guard var)) 'left)
  (_ 'right))

==> 'right

But

(pcase 1
  ((and (let var left) (guard var)) 'left)
  ((and (let var right) (guard var)) 'right))

==> nil

It should also return right, no?


Michael.





  reply	other threads:[~2013-07-03 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 21:19 bug#14773: 24.2; pcase John Williams
2013-07-03  9:34 ` Stefan Monnier
2013-07-03 16:53   ` Michael Heerdegen [this message]
2013-07-03 22:53     ` Stefan Monnier
2013-07-08 21:56     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwq3d1pp.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=14773@debbugs.gnu.org \
    --cc=jrw@google.com \
    --cc=monnier@IRO.UMontreal.CA \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).