[Top][All Lists]

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

bug#20268: 25.0.50; pcase-lambda broken

From: Stefan Monnier
Subject: bug#20268: 25.0.50; pcase-lambda broken
Date: Wed, 08 Apr 2015 10:35:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> 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

reply via email to

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