From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Stefan Monnier via "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#45619: 28.0.50; pcase-let on MacOS doesn't work
Date: Sat, 12 Feb 2022 17:33:57 -0500
Message-ID: <jwvfsonn2gj.fsf-monnier+emacs@gnu.org>
References: <tencent_420EB82A750AC42DCD81ECB23589C171FE07@qq.com>
 <877dos50su.fsf@web.de> <87k0e04jet.fsf@gnus.org>
 <jwvr188ywem.fsf-monnier+emacs@gnu.org> <87iltk11z5.fsf@gnus.org>
 <jwvv8xkovwb.fsf-monnier+emacs@gnu.org> <87ee480zms.fsf@gnus.org>
Reply-To: Stefan Monnier <monnier@iro.umontreal.ca>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="3018"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Cc: Michael Heerdegen <michael_heerdegen@web.de>, jixiuf <jixiuf@qq.com>,
 45619@debbugs.gnu.org
To: Lars Ingebrigtsen <larsi@gnus.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 12 23:35:23 2022
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1nJ0zD-0000bi-88
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Feb 2022 23:35:23 +0100
Original-Received: from localhost ([::1]:60816 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1nJ0zB-0007hG-JM
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Feb 2022 17:35:21 -0500
Original-Received: from eggs.gnu.org ([209.51.188.92]:60172)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1nJ0ys-0007h3-Sv
 for bug-gnu-emacs@gnu.org; Sat, 12 Feb 2022 17:35:03 -0500
Original-Received: from debbugs.gnu.org ([209.51.188.43]:41987)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1nJ0ys-0000G8-Il
 for bug-gnu-emacs@gnu.org; Sat, 12 Feb 2022 17:35:02 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nJ0ys-0002jD-Gp
 for bug-gnu-emacs@gnu.org; Sat, 12 Feb 2022 17:35:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Stefan Monnier <monnier@iro.umontreal.ca>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 12 Feb 2022 22:35:02 +0000
Resent-Message-ID: <handler.45619.B45619.164470524910418@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 45619
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: moreinfo
Original-Received: via spool by 45619-submit@debbugs.gnu.org id=B45619.164470524910418
 (code B ref 45619); Sat, 12 Feb 2022 22:35:02 +0000
Original-Received: (at 45619) by debbugs.gnu.org; 12 Feb 2022 22:34:09 +0000
Original-Received: from localhost ([127.0.0.1]:35884 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1nJ0y1-0002hy-1d
 for submit@debbugs.gnu.org; Sat, 12 Feb 2022 17:34:09 -0500
Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:49014)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@iro.umontreal.ca>) id 1nJ0xy-0002hT-Qu
 for 45619@debbugs.gnu.org; Sat, 12 Feb 2022 17:34:07 -0500
Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C3DE5100211;
 Sat, 12 Feb 2022 17:34:00 -0500 (EST)
Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 286D3100124;
 Sat, 12 Feb 2022 17:33:59 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1644705239;
 bh=9Y8RrKn+2THvPSnQRuOzRLWuBanJWoc/Denn8yAoz6Y=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=EAVwdIW4I3JCMBMuL0T65pgEvrfRBwhZFkIrlZjmNtQ8YVQIQw/TeXvU2RyGl/xhX
 teu/VbAB9ppftIBiKV/F/2f8TISiYSdsYCcfpmHYlrEs/xYRmxR6yRUYVpvffoawMo
 axTV7j9bGWQCxYMh5YhBnxeYV39gknYqS4Ajq7YAn9Atdyp3huw5wYy0f/VwWt+TOf
 bg50+16VUSehEOGeKDmeRPDp1JUhefQTnnAACe6M0nkKdNzDepR5HhyVe1WOZpLH8d
 wc7VNdbreOupKCt1YI6AmScS52RcfZQgwg7AanScBqhUztKXxFakftwDt40jOpD5kP
 2KIILvpYwmBSg==
Original-Received: from pastel (unknown [45.72.237.157])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E2DB012059A;
 Sat, 12 Feb 2022 17:33:58 -0500 (EST)
In-Reply-To: <87ee480zms.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat,
 12 Feb 2022 18:21:31 +0100")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "bug-gnu-emacs"
 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.bugs:226753
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/226753>

Lars Ingebrigtsen [2022-02-12 18:21:31] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I don't think a single example can represent all cases.  Try:
>>
>>     (defun zot ()
>>       (pcase-let (((or `(,foo) foo) '(2)))
>>         (progn (bar))))
>
> Hm, yes.
>
>>>> I still think pcase should emit a warning when asked to bind
>>>> a dynamically scoped variable.
>>> If pcase-let currently does work fine for dynamic variables then it's
>>> likely that people are depending on it, and it's too late to change...
>>
>> I don't mean to change the generated code, but to discourage such uses
>> since they may break when the code is modified in apparently-minor ways.
>> Hence a warning.
>
> Byte-compiling this does yield a warning in Emacs 29:
>
> pcase.el:6:28: Warning: Lexical argument shadows the dynamic variable foo

Two problems with this:
- The warning talks about the generated code rather than the source
  code, so it's hard for the user to understand what's going on
  (there's no *argument* by that name in their code).
- The warning only shows up when the problem actually bites, whereas we
  should warn about all uses of dynamically scoped vars, since they all
  *may* bite at some point.
- You only get the warning if you byte-compile the code.


        Stefan "off-by-one 4ever (in short, 5ever)"