GNU bug report logs - #20268
25.0.50; pcase-lambda broken

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Tue, 7 Apr 2015 07:43:02 UTC

Severity: wishlist

Found in version 25.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 20268 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 20268 <at> debbugs.gnu.org
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
Date: Wed, 08 Apr 2015 10:35:53 -0400
> I don't mind new semantics but I want to make sense of it so as to use
> it with confidence. What I am seeing is:
> (funcall (pcase-lambda (`[fullsweep_after ,v]) v) [min_bin_vheap_size 46422])

When destructuring (as opposed to performing case-analysis), pcase.el
takes as a given that the pattern does match, so the pattern is
basically only used to decide from where to extract the information to
bind the variables.  So the following patterns are equivalent:

   `[fullsweep_after ,v]

   `[,_ ,v]

   `[,(pred foo) ,v]

If you want to test that the pattern matches, that means someone needs
to decide what happens when the pattern doesn't match.  The previous
behavior was to "do nothing and return nil", which is too arbitrary for
my taste, so if you want that, you need to write it

   (lambda (x) (pcase (`[fullsweep_after ,v] v)))


-- Stefan




This bug report was last modified 3 years and 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.