From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#20268: 25.0.50; pcase-lambda broken Date: Tue, 07 Apr 2015 22:14:29 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428459328 6504 80.91.229.3 (8 Apr 2015 02:15:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Apr 2015 02:15:28 +0000 (UTC) Cc: 20268@debbugs.gnu.org To: Leo Liu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 08 04:15:12 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YffWJ-0000LU-IN for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Apr 2015 04:15:11 +0200 Original-Received: from localhost ([::1]:50105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YffWI-0005Gq-KJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Apr 2015 22:15:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YffWF-0005EP-4I for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 22:15:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YffWB-00085Y-T1 for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 22:15:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YffWB-000853-Py for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 22:15:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YffWB-0004pd-4V for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 22:15:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Apr 2015 02:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20268 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20268-submit@debbugs.gnu.org id=B20268.142845927718526 (code B ref 20268); Wed, 08 Apr 2015 02:15:02 +0000 Original-Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 02:14:37 +0000 Original-Received: from localhost ([127.0.0.1]:48629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YffVk-0004oj-T8 for submit@debbugs.gnu.org; Tue, 07 Apr 2015 22:14:37 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:42987) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YffVj-0004oV-50 for 20268@debbugs.gnu.org; Tue, 07 Apr 2015 22:14:35 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnEFAGvvdVRBbthL/2dsb2JhbAA3gVOfQYIugQiBdQEBBAFWIwULCw4mEhQYDSSIE6IRjGQMA4M+A4NwBKg7 X-IPAS-Result: AnEFAGvvdVRBbthL/2dsb2JhbAA3gVOfQYIugQiBdQEBBAFWIwULCw4mEhQYDSSIE6IRjGQMA4M+A4NwBKg7 X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="115665573" Original-Received: from 65-110-216-75.cpe.pppoe.ca (HELO pastel.home) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Apr 2015 22:14:29 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A335A1209; Tue, 7 Apr 2015 22:14:29 -0400 (EDT) In-Reply-To: (Leo Liu's message of "Tue, 07 Apr 2015 15:42:32 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101276 Archived-At: > After the recent rewrite, pcase-lambda is broken. For example, eval the > following to get 46422 instead of the correct value 65535. > (cl-some (pcase-lambda (`[fullsweep_after ,v]) v) > '([min_bin_vheap_size 46422] > [min_heap_size 233] > [fullsweep_after 65535] > [minor_gcs 40])) Indeed, that's the semantics I chose. The previous semantics was for the function to do nothing and return nil if the arg doesn't match. The new semantics is the same as the one used by pcase-let. It's not without its fault of course, but at least it does correspond to the usual idea of "destructuring" and generates more efficient code. I think if you prefer to return nil, then the macro should look like (pcase-lambda ((`[fullsweep_after ,v]) v)) which would then naturally let you add additional cases like (pcase-lambda ((`[fullsweep_after ,v]) v) ((`[min_heap_size ,v]) (/ v 2))) Admittedly, for the current pcase-lambda (and pcase-let) macro, the pcase.el code should be refined so as to emit a warning when it ends up ignoring a constant like `fullsweep_after' above. Stefan