bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#14773: 24.2; pcase


From: Michael Heerdegen
Subject: bug#14773: 24.2; pcase
Date: Wed, 03 Jul 2013 18:53:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> 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 via email to

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