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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Leo Liu <sdl.web@HIDDEN>; dated Tue, 7 Apr 2015 07:43:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 22:21:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 18:21:22 2015
Received: from localhost ([127.0.0.1]:49605 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YfyLZ-0006SN-MP
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 18:21:21 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:37223)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <drew.adams@HIDDEN>) id 1YfyLX-0006SA-RD
 for 20268 <at> debbugs.gnu.org; Wed, 08 Apr 2015 18:21:20 -0400
Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233])
 by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id
 t38MLCDW017328
 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Wed, 8 Apr 2015 22:21:12 GMT
Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236])
 by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t38MLAxD027061
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL);
 Wed, 8 Apr 2015 22:21:10 GMT
Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16])
 by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t38MLASa007739;
 Wed, 8 Apr 2015 22:21:10 GMT
MIME-Version: 1.0
Message-ID: <b2d1151e-4b09-4ed7-8313-7a9437bcfe22@default>
Date: Wed, 8 Apr 2015 15:21:10 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: RE: bug#20268: 25.0.50; pcase-lambda broken
References: <m2zj6k5qqf.fsf@HIDDEN>
 <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
 <CAArVCkQsn7eQ4Ffag3a-xf3JDyP6OTEfw42eNSqgq+2AKeZKWA@HIDDEN>
 <jwviod6pgvs.fsf-monnier+emacsbugs@HIDDEN>
 <6814e575-e76b-4ef5-92a5-ce2c947beeb6@default>
 <jwvegnunwdt.fsf-monnier+emacsbugs@HIDDEN>
In-Reply-To: <jwvegnunwdt.fsf-monnier+emacsbugs@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2  (807160) [OL
 12.0.6691.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: aserv0021.oracle.com [141.146.126.233]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 20268
Cc: Philipp Stephani <p.stephani2@HIDDEN>, Leo Liu <sdl.web@HIDDEN>,
 20268 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

> > Just out of curiosity, what was the reason we didn't go in the
> > direction of Common Lisp's `destructuring-bind' etc., which would
> > let you write just (a b c) instead of `(,b ,_ ,c)?
>=20
> For example because it doesn't let you write
>    (pcase-let ((cl-struct mytype slot1 slot3) (myexp)) ...)

What part of "go in the direction of Common Lisp's
`destructuring-bind' etc." implies that you cannot go beyond it
to support that kind of thing?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 21:29:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 17:29:27 2015
Received: from localhost ([127.0.0.1]:49581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YfxXK-0005EW-NM
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 17:29:27 -0400
Received: from mercure.iro.umontreal.ca ([132.204.24.67]:35130)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1YfxXI-0005EO-KB
 for 20268 <at> debbugs.gnu.org; Wed, 08 Apr 2015 17:29:24 -0400
Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca
 [132.204.27.50])
 by mercure.iro.umontreal.ca (Postfix) with ESMTP id 788AD86076;
 Wed,  8 Apr 2015 17:29:24 -0400 (EDT)
Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca
 [132.204.27.242])
 by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 5C13D1E5B8C;
 Wed,  8 Apr 2015 17:29:01 -0400 (EDT)
Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848)
 id 417CBB4122; Wed,  8 Apr 2015 17:29:01 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
Message-ID: <jwvegnunwdt.fsf-monnier+emacsbugs@HIDDEN>
References: <m2zj6k5qqf.fsf@HIDDEN>
 <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
 <CAArVCkQsn7eQ4Ffag3a-xf3JDyP6OTEfw42eNSqgq+2AKeZKWA@HIDDEN>
 <jwviod6pgvs.fsf-monnier+emacsbugs@HIDDEN>
 <6814e575-e76b-4ef5-92a5-ce2c947beeb6@default>
Date: Wed, 08 Apr 2015 17:29:01 -0400
In-Reply-To: <6814e575-e76b-4ef5-92a5-ce2c947beeb6@default> (Drew Adams's
 message of "Wed, 8 Apr 2015 13:31:55 -0700 (PDT)")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-DIRO-MailScanner-Information: Please contact the ISP for more information
X-DIRO-MailScanner: Found to be clean
X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel,
 SpamAssassin (score=-2.82, requis 5, autolearn=not spam,
 ALL_TRUSTED -2.82, MC_TSTLAST 0.00)
X-DIRO-MailScanner-From: monnier@HIDDEN
X-Spam-Status: No
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 20268
Cc: Philipp Stephani <p.stephani2@HIDDEN>, Leo Liu <sdl.web@HIDDEN>,
 20268 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

> Just out of curiosity, what was the reason we didn't go in the
> direction of Common Lisp's `destructuring-bind' etc., which would
> let you write just (a b c) instead of `(,b ,_ ,c)?

For example because it doesn't let you write

   (pcase-let ((cl-struct mytype slot1 slot3) (myexp))
     ...)


-- Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 20:32:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 16:32:04 2015
Received: from localhost ([127.0.0.1]:49556 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Yfwdn-0003tB-Qg
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 16:32:04 -0400
Received: from aserp1040.oracle.com ([141.146.126.69]:35731)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <drew.adams@HIDDEN>) id 1Yfwdm-0003sh-D6
 for 20268 <at> debbugs.gnu.org; Wed, 08 Apr 2015 16:32:02 -0400
Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234])
 by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id
 t38KVtHq008579
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Wed, 8 Apr 2015 20:31:56 GMT
Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236])
 by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t38KVtsS023688
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL);
 Wed, 8 Apr 2015 20:31:55 GMT
Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16])
 by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t38KVt4C028875;
 Wed, 8 Apr 2015 20:31:55 GMT
MIME-Version: 1.0
Message-ID: <6814e575-e76b-4ef5-92a5-ce2c947beeb6@default>
Date: Wed, 8 Apr 2015 13:31:55 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, Philipp Stephani
 <p.stephani2@HIDDEN>
Subject: RE: bug#20268: 25.0.50; pcase-lambda broken
References: <m2zj6k5qqf.fsf@HIDDEN>
 <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
 <CAArVCkQsn7eQ4Ffag3a-xf3JDyP6OTEfw42eNSqgq+2AKeZKWA@HIDDEN>
 <jwviod6pgvs.fsf-monnier+emacsbugs@HIDDEN>
In-Reply-To: <jwviod6pgvs.fsf-monnier+emacsbugs@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2  (807160) [OL
 12.0.6691.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: aserv0022.oracle.com [141.146.126.234]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 20268
Cc: Leo Liu <sdl.web@HIDDEN>, 20268 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

> I.e. the code you'd have written without pcase-let would have been
>=20
>       (let ((a (foo))
>             (b (car foo))
>             (c (nth 2 foo)))
>=20
> which would naturally turn into a pattern like `(,b ,_ ,c)

Just out of curiosity, what was the reason we didn't go in the
direction of Common Lisp's `destructuring-bind' etc., which would
let you write just (a b c) instead of `(,b ,_ ,c)?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 19:26:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 15:26:02 2015
Received: from localhost ([127.0.0.1]:49501 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Yfvbt-0000p1-JK
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 15:26:01 -0400
Received: from mercure.iro.umontreal.ca ([132.204.24.67]:47007)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1Yfvbs-0000ot-4f
 for 20268 <at> debbugs.gnu.org; Wed, 08 Apr 2015 15:26:00 -0400
Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca
 [132.204.27.50])
 by mercure.iro.umontreal.ca (Postfix) with ESMTP id C35C59C128;
 Wed,  8 Apr 2015 15:25:59 -0400 (EDT)
Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca
 [132.204.27.242])
 by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id D9A2E1E5B8C;
 Wed,  8 Apr 2015 15:25:36 -0400 (EDT)
Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848)
 id BB6FCB4122; Wed,  8 Apr 2015 15:25:36 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Philipp Stephani <p.stephani2@HIDDEN>
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
Message-ID: <jwviod6pgvs.fsf-monnier+emacsbugs@HIDDEN>
References: <m2zj6k5qqf.fsf@HIDDEN>
 <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
 <CAArVCkQsn7eQ4Ffag3a-xf3JDyP6OTEfw42eNSqgq+2AKeZKWA@HIDDEN>
Date: Wed, 08 Apr 2015 15:25:36 -0400
In-Reply-To: <CAArVCkQsn7eQ4Ffag3a-xf3JDyP6OTEfw42eNSqgq+2AKeZKWA@HIDDEN>
 (Philipp Stephani's message of "Wed, 08 Apr 2015 15:08:36 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-DIRO-MailScanner-Information: Please contact the ISP for more information
X-DIRO-MailScanner: Found to be clean
X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel,
 SpamAssassin (score=-2.82, requis 5, autolearn=not spam,
 ALL_TRUSTED -2.82, MC_TSTLAST 0.00)
X-DIRO-MailScanner-From: monnier@HIDDEN
X-Spam-Status: No
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 20268
Cc: Leo Liu <sdl.web@HIDDEN>, 20268 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

> Why not raise an error instead if there is no match

That would be an acceptable semantics, yes.  I happen to dislike it
because of the performance cost, where in most use-cases you know the
pattern will match and just want to replace a bunch of car/cdr/aref with
a single pattern.

I.e. the code you'd have written without pcase-let would have been

      (let ((a (foo))
            (b (car foo))
            (c (nth 2 foo)))

which would naturally turn into a pattern like `(,b ,_ ,c)
but if you want to signal an error when the pattern fails to match, then
you get 3 additional consp tests plus a null test, at which point the
performance impact can become noticeable.  You can get rid of the null
test with a pattern like `(,b ,_ ,c . ,_) but you can't get rid of the
3 consp tests.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 15:08:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 11:08:48 2015
Received: from localhost ([127.0.0.1]:49309 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Yfray-00038s-0T
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 11:08:48 -0400
Received: from mail-wi0-f179.google.com ([209.85.212.179]:33551)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <p.stephani2@HIDDEN>) id 1Yfrar-00038a-SU
 for 20268 <at> debbugs.gnu.org; Wed, 08 Apr 2015 11:08:46 -0400
Received: by wiax7 with SMTP id x7so35299351wia.0
 for <20268 <at> debbugs.gnu.org>; Wed, 08 Apr 2015 08:08:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc:content-type;
 bh=947KW7qPNmlhUkOnUGIRXg7jV2pVuQsYu8yG01v1ve0=;
 b=VBhIrLpC7rDWZAlv7cdej2jLc7YRwE3LiZjKcZ1pB00Na6vRozQDDt2LSIewO96qMW
 d+nzEU89UIxfDgkQGNKnDjimNgMEBh0QC9JezHYl9toJqaqqzKifYC9rM6Gs2rHTyxDj
 2DwrPHIiyVl68CpwD0qZNiWhXmQ9VEnRGaz3V5D4Vz800j0DcO114zr5DdqhLN6t5Kpg
 qc2UMaeE5GwNaiZZ29xJWivopjYhZtr/50hpP4ENof0NHLkIxJfv5lszkyNOqLfuk/Fb
 z8XkAZnfOL5dwI9GYwOwC23vLNGVaqknWN8ETNhnTYSWEfOzaXcbKtoZrHmq9NQteaUJ
 lELQ==
X-Received: by 10.194.19.166 with SMTP id g6mr51725882wje.150.1428505716328;
 Wed, 08 Apr 2015 08:08:36 -0700 (PDT)
MIME-Version: 1.0
References: <m2zj6k5qqf.fsf@HIDDEN>
 <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
In-Reply-To: <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
From: Philipp Stephani <p.stephani2@HIDDEN>
Date: Wed, 08 Apr 2015 15:08:36 +0000
Message-ID: <CAArVCkQsn7eQ4Ffag3a-xf3JDyP6OTEfw42eNSqgq+2AKeZKWA@HIDDEN>
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
To: Stefan Monnier <monnier@HIDDEN>, Leo Liu <sdl.web@HIDDEN>
Content-Type: multipart/alternative; boundary=047d7b3a8b34c8105b051337e7f4
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 20268
Cc: 20268 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

--047d7b3a8b34c8105b051337e7f4
Content-Type: text/plain; charset=UTF-8

Stefan Monnier <monnier@HIDDEN> schrieb am Mi., 8. Apr. 2015 um
04:15 Uhr:

> > 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.
>
>
Why not raise an error instead if there is no match (or even if any quoted
or self-quoting expressions are used at all)? The current behavior is quite
confusing, and warnings tend to be ignored.

Given that pcase-let, pcase-lambda and pcase-dolist don't do any
case-by-case analysis, maybe they should even be renamed and moved out of
pcase.el.

--047d7b3a8b34c8105b051337e7f4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote">Stefan Monnier &lt;<a h=
ref=3D"mailto:monnier@HIDDEN">monnier@HIDDEN</a>&gt; sc=
hrieb am Mi., 8. Apr. 2015 um 04:15=C2=A0Uhr:<br><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">&gt; After the recent rewrite, pcase-lambda is broken. For example, ev=
al the<br>
&gt; following to get 46422 instead of the correct value 65535.<br>
<br>
&gt;=C2=A0 =C2=A0 (cl-some (pcase-lambda (`[fullsweep_after ,v]) v)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;([min_bin_vheap_si=
ze 46422]<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[min_heap_size 2=
33]<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[fullsweep_after=
 65535]<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[minor_gcs 40]))=
<br>
<br>
Indeed, that&#39;s the semantics I chose.<br>
The previous semantics was for the function to do nothing and return nil<br=
>
if the arg doesn&#39;t match.=C2=A0 The new semantics is the same as the on=
e used<br>
by pcase-let.=C2=A0 It&#39;s not without its fault of course, but at least =
it does<br>
correspond to the usual idea of &quot;destructuring&quot; and generates mor=
e<br>
efficient code.<br>
<br>
I think if you prefer to return nil, then the macro should look like<br>
<br>
=C2=A0 =C2=A0(pcase-lambda ((`[fullsweep_after ,v]) v))<br>
<br>
which would then naturally let you add additional cases like<br>
<br>
=C2=A0 =C2=A0(pcase-lambda ((`[fullsweep_after ,v]) v)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((`[min_heap_=
size ,v]) (/ v 2)))<br>
<br>
Admittedly, for the current pcase-lambda (and pcase-let) macro, the<br>
pcase.el code should be refined so as to emit a warning when it ends up<br>
ignoring a constant like `fullsweep_after&#39; above.<br>
<br>
</blockquote><div><br></div><div>Why not raise an error instead if there is=
 no match (or even if any quoted or self-quoting expressions are used at al=
l)? The current behavior is quite confusing, and warnings tend to be ignore=
d.=C2=A0</div><div><br></div><div>Given that pcase-let, pcase-lambda and pc=
ase-dolist don&#39;t do any case-by-case analysis, maybe they should even b=
e renamed and moved out of pcase.el.</div></div></div>

--047d7b3a8b34c8105b051337e7f4--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 14:36:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 10:36:09 2015
Received: from localhost ([127.0.0.1]:49254 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Yfr5J-0000rS-3K
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 10:36:09 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:63680)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1Yfr5D-0000qu-2F
 for 20268 <at> debbugs.gnu.org; Wed, 08 Apr 2015 10:36:03 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AnEFAGvvdVRBbthL/2dsb2JhbAA3gVOfQYIugQiBdQEBBAFWIwULCw4mEhQYDSSIE6IRi3YKDBENOgkDA4M+A4NwBKg7
X-IPAS-Result: AnEFAGvvdVRBbthL/2dsb2JhbAA3gVOfQYIugQiBdQEBBAFWIwULCw4mEhQYDSSIE6IRi3YKDBENOgkDA4M+A4NwBKg7
X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; 
   d="scan'208";a="115708029"
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;
 08 Apr 2015 10:35:53 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 6D9791FC7; Wed,  8 Apr 2015 10:35:53 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Leo Liu <sdl.web@HIDDEN>
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
Message-ID: <jwv384asniq.fsf-monnier+emacsbugs@HIDDEN>
References: <m2zj6k5qqf.fsf@HIDDEN> <m1twwrcu1y.fsf@HIDDEN>
Date: Wed, 08 Apr 2015 10:35:53 -0400
In-Reply-To: <m1twwrcu1y.fsf@HIDDEN> (Leo Liu's message of "Wed, 08 Apr
 2015 09:01:13 +0800")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 20268
Cc: 20268 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 Apr 2015 13:23:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 09:23:22 2015
Received: from localhost ([127.0.0.1]:48923 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Yfpwv-0007Ui-D0
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 09:23:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44118)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Yfpws-0007US-OY
 for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 09:23:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Yfpwj-0002nO-Na
 for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 09:23:13 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:37301)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Yfpwj-0002nK-KC
 for submit <at> debbugs.gnu.org; Wed, 08 Apr 2015 09:23:09 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57615)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Yfpwi-0004Df-IA
 for bug-gnu-emacs@HIDDEN; Wed, 08 Apr 2015 09:23:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Yfpwb-0002lb-2H
 for bug-gnu-emacs@HIDDEN; Wed, 08 Apr 2015 09:23:08 -0400
Received: from plane.gmane.org ([80.91.229.3]:34382)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Yfpwa-0002l7-RO
 for bug-gnu-emacs@HIDDEN; Wed, 08 Apr 2015 09:23:00 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1YfpwW-0001kf-DM
 for bug-gnu-emacs@HIDDEN; Wed, 08 Apr 2015 15:22:56 +0200
Received: from uk.solarflare.com ([193.34.186.16])
 by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
 id 1AlnuQ-0007hv-00
 for <bug-gnu-emacs@HIDDEN>; Wed, 08 Apr 2015 15:22:56 +0200
Received: from andrewjmoreton by uk.solarflare.com with local (Gmexim 0.1
 (Debian)) id 1AlnuQ-0007hv-00
 for <bug-gnu-emacs@HIDDEN>; Wed, 08 Apr 2015 15:22:56 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Andy Moreton <andrewjmoreton@HIDDEN>
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
Date: Wed, 08 Apr 2015 14:22:46 +0100
Lines: 40
Message-ID: <vz1bniy3gbd.fsf@HIDDEN>
References: <m2zj6k5qqf.fsf@HIDDEN>
 <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: usenet@HIDDEN
X-Gmane-NNTP-Posting-Host: uk.solarflare.com
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt)
Cancel-Lock: sha1:d+CmCwakud96v1rpRj0cy+y8byk=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.1 (----)

On Tue 07 Apr 2015, Stefan Monnier wrote:

>> 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.

Please improve the documentation for the pcase macros:

 a) The elisp manual has reference documentation for pcase, but it is
    confusing and short on examples. The first example would be clearer
    if it was more like the second example, by showing some example
    forms that invoke pcase and the result of evaluating them.

    The description would flow more logically if the second example
    followed the reference that describes the allowed patterns, and 
    included an example of each type of pattern.

 b) Add meaningful help strings for pcase-lambda, pcase-let* and
    pcase-let. The existing help strings all say that these constructs
    are "the same as another thing only different" which only serves to
    obscure what they do. A user should be able to discern what the
    interface contract is without reading the implementation. A short
    motivating example for each macro would be helpful.

These improvements would make code using the pcase macros more readable,
and aid understanding of the intended semantics.

    AndyM





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 02:14:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 22:14:37 2015
Received: from localhost ([127.0.0.1]:48629 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YffVk-0004oj-T8
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2015 22:14:37 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:42987)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1YffVj-0004oV-50
 for 20268 <at> 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"
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
Received: by pastel.home (Postfix, from userid 20848)
 id A335A1209; Tue,  7 Apr 2015 22:14:29 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Leo Liu <sdl.web@HIDDEN>
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
Message-ID: <jwv6197v024.fsf-monnier+emacsbugs@HIDDEN>
References: <m2zj6k5qqf.fsf@HIDDEN>
Date: Tue, 07 Apr 2015 22:14:29 -0400
In-Reply-To: <m2zj6k5qqf.fsf@HIDDEN> (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)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 20268
Cc: 20268 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at 20268 <at> debbugs.gnu.org:


Received: (at 20268) by debbugs.gnu.org; 8 Apr 2015 01:01:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 21:01:30 2015
Received: from localhost ([127.0.0.1]:48606 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YfeMz-00033j-NZ
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2015 21:01:30 -0400
Received: from mail-pd0-f170.google.com ([209.85.192.170]:33355)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <sdl.web@HIDDEN>) id 1YfeMx-00033V-MI
 for 20268 <at> debbugs.gnu.org; Tue, 07 Apr 2015 21:01:28 -0400
Received: by pdbnk13 with SMTP id nk13so96788969pdb.0
 for <20268 <at> debbugs.gnu.org>; Tue, 07 Apr 2015 18:01:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:cc:subject:references:face:date:in-reply-to:message-id
 :user-agent:mime-version:content-type;
 bh=Xleu0gW2qi1sZ1RAhkNFTxqyIkAb9siW7+Jkb4dY2Hs=;
 b=grf/vMORisIxz712tjDPtRbKOBtjz7NqmaAqnU3S58XaNimuO8ZSoSF0n1xOVcZEVO
 ODOvkhJ17kcvVJ03XVIwtgR15NSlJORcS4YvYpMZ6s7xOVkf+hab8wMRsvZhqR597UKK
 qZHqYYda81epoeSGf8WzE3Xvj37X5w52fmke5hq5o0/HZChhwF0SS/FSMVrfrPL3jFLL
 gRexXRnYOQQqaOXSX4JglAHKWeTQhAiZha5bSGkKs06ADMJJptKOaHEkRYb9N36V5kmx
 lzdlAZvrMjpIW+O+QTO7S4sCZN9ktQ6Kkc/gLNkZH0yahrqsPtj4MaDxJlnWQjI7oYP3
 vj9w==
X-Received: by 10.70.135.106 with SMTP id pr10mr41153594pdb.156.1428454881618; 
 Tue, 07 Apr 2015 18:01:21 -0700 (PDT)
Received: from zeuss-MBP.lan ([128.199.230.246])
 by mx.google.com with ESMTPSA id fm3sm9329521pdb.73.2015.04.07.18.01.18
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 07 Apr 2015 18:01:20 -0700 (PDT)
From: Leo Liu <sdl.web@HIDDEN>
To: 20268 <at> debbugs.gnu.org
Subject: Re: bug#20268: 25.0.50; pcase-lambda broken
References: <m2zj6k5qqf.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg
 op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA
 AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0
 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV
 B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh
 thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC
 HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/
 xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx
 aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4
 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc
 DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC
Date: Wed, 08 Apr 2015 09:01:13 +0800
In-Reply-To: <m2zj6k5qqf.fsf@HIDDEN> (Leo Liu's message of "Tue, 07 Apr
 2015 15:42:32 +0800")
Message-ID: <m1twwrcu1y.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (OS X 10.10.2)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 20268
Cc: Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Forgive me to rely here. None of our messages shown up in bug#19670.

> After recent rewrite of pcase-lambda I am seeing:

> (cl-some (pcase-lambda (`[fullsweep_after ,v]) v)
>         '([min_bin_vheap_size 46422]
>           [min_heap_size 233]
>           [fullsweep_after 65535]
>
>           [minor_gcs 10]))
>
> 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 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])

=> 46422

That doesn't make sense to me. Could you explain why this is the right
thing?

> 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)))

I didn't choose the multiple-clause version because it is a cheap
shortcut for (lambda (...) (pcase ... ...)).

The single-clause pcase-lambda makes a lot of higher-order functions fun
to use and that is where I am reaping the benefits.

> 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.

Yes, I am having a lot of trouble understanding and using pcase-let*
except for trivial cases. I don't want the same thing to happen to
pcase-lambda.

>        Stefan

Thanks,
Leo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Apr 2015 07:42:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 03:42:53 2015
Received: from localhost ([127.0.0.1]:46927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YfO9t-0008Oz-JB
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2015 03:42:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49284)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <sdl.web@HIDDEN>) id 1YfO9r-0008Oo-O7
 for submit <at> debbugs.gnu.org; Tue, 07 Apr 2015 03:42:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <sdl.web@HIDDEN>) id 1YfO9l-00008o-IE
 for submit <at> debbugs.gnu.org; Tue, 07 Apr 2015 03:42:46 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:53894)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <sdl.web@HIDDEN>) id 1YfO9l-00008j-Fy
 for submit <at> debbugs.gnu.org; Tue, 07 Apr 2015 03:42:45 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34547)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <sdl.web@HIDDEN>) id 1YfO9k-00067n-Ng
 for bug-gnu-emacs@HIDDEN; Tue, 07 Apr 2015 03:42:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <sdl.web@HIDDEN>) id 1YfO9g-00006w-JO
 for bug-gnu-emacs@HIDDEN; Tue, 07 Apr 2015 03:42:44 -0400
Received: from mail-pd0-x235.google.com ([2607:f8b0:400e:c02::235]:36550)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <sdl.web@HIDDEN>) id 1YfO9g-00006T-Cb
 for bug-gnu-emacs@HIDDEN; Tue, 07 Apr 2015 03:42:40 -0400
Received: by pdea3 with SMTP id a3so70543103pde.3
 for <bug-gnu-emacs@HIDDEN>; Tue, 07 Apr 2015 00:42:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:subject:date:message-id:mime-version:content-type;
 bh=FY2fxzkU/r+vIbjEKWPV8pFOWHS9NFlDcc93ql2QbhA=;
 b=QcsEBR54Eznv0seLTPnGuLGW09xRAAVYa5LpR913U7uYvS2UWFOfjiRlNhqjYZkAwK
 rpiQDtP5SgmugoNyV2nbzKqjkq3KKW9S5CERigk+BkfzfaEyR+BuA031lhhduXQpfiuT
 AJRtRnGCKT6Je5jNMvDH1cikiV8DCE3/z85Cq/1UmO0XGOH8bze7gd40g8HKNUFPUX3z
 5IHAjcSg80WNd9+rsSybIbL8sNLOjig16XuRrVJM+WDiSttGPirDMCcTTMbEVQHDrMup
 b3aVDq5poWQT8RWJuGJs+srm55RcuNLgbOL9AhJB/65TXrGFC/mFOPzVzvDRmb0PAlaR
 hyBg==
X-Received: by 10.70.91.225 with SMTP id ch1mr34363581pdb.65.1428392558852;
 Tue, 07 Apr 2015 00:42:38 -0700 (PDT)
Received: from Shidais-iMac.local ([128.199.230.246])
 by mx.google.com with ESMTPSA id rt12sm7109196pab.34.2015.04.07.00.42.36
 for <bug-gnu-emacs@HIDDEN>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 07 Apr 2015 00:42:38 -0700 (PDT)
From: Leo Liu <sdl.web@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 25.0.50; pcase-lambda broken
X-Debbugs-CC: Stefan Monnier <monnier@HIDDEN>
Date: Tue, 07 Apr 2015 15:42:32 +0800
Message-ID: <m2zj6k5qqf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)


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]))

Thanks,
Leo




Acknowledgement sent to Leo Liu <sdl.web@HIDDEN>:
New bug report received and forwarded. Copy sent to monnier@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to monnier@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#20268; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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