From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups: gmane.emacs.bugs
Subject: bug#45619: 28.0.50; pcase-let on MacOS doesn't work
Date: Mon, 04 Jan 2021 12:41:26 -0500
Message-ID: <jwvft3gtxfb.fsf-monnier+emacs@gnu.org>
References: <tencent_420EB82A750AC42DCD81ECB23589C171FE07@qq.com>
 <877dos50su.fsf@web.de>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="34083"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Cc: jixiuf <jixiuf@qq.com>, 45619@debbugs.gnu.org
To: Michael Heerdegen <michael_heerdegen@web.de>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 04 18:39:33 2021
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 1kwTpM-0008iu-Lf
	for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Jan 2021 18:39:32 +0100
Original-Received: from localhost ([::1]:55202 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 1kwTpL-0007ZL-Mn
	for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Jan 2021 12:39:31 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36140)
 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 1kwTos-0007OF-2O
 for bug-gnu-emacs@gnu.org; Mon, 04 Jan 2021 12:39:02 -0500
Original-Received: from debbugs.gnu.org ([209.51.188.43]:48639)
 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 1kwTor-0006Ya-QW
 for bug-gnu-emacs@gnu.org; Mon, 04 Jan 2021 12:39:01 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1kwTor-0004NS-Nh
 for bug-gnu-emacs@gnu.org; Mon, 04 Jan 2021 12:39:01 -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: Mon, 04 Jan 2021 17:39:01 +0000
Resent-Message-ID: <handler.45619.B45619.160978193316811@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 45619
X-GNU-PR-Package: emacs
Original-Received: via spool by 45619-submit@debbugs.gnu.org id=B45619.160978193316811
 (code B ref 45619); Mon, 04 Jan 2021 17:39:01 +0000
Original-Received: (at 45619) by debbugs.gnu.org; 4 Jan 2021 17:38:53 +0000
Original-Received: from localhost ([127.0.0.1]:60185 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1kwToj-0004N3-H1
 for submit@debbugs.gnu.org; Mon, 04 Jan 2021 12:38:53 -0500
Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17072)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@iro.umontreal.ca>) id 1kwToi-0004Mr-As
 for 45619@debbugs.gnu.org; Mon, 04 Jan 2021 12:38:52 -0500
Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6F5944409FF;
 Mon,  4 Jan 2021 12:38:46 -0500 (EST)
Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2EFD344091A;
 Mon,  4 Jan 2021 12:38:45 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1609781925;
 bh=sT/XNTeWcreHTFskOTkeGOq0Zmkn7H3FZDpelf1K6b0=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=aUd7MtLubH6lXt641djs8qpL2rrwyZoHwc9z97yIKKw1syKfjkI1ZJHq8HvbQmPXm
 /SZkqwEjrhPnsN5usRx1BmFwxWKVodG743lJ4Ya3ih7mTqPfvmA+rk4FMOnrgciVIr
 mzp6AHNnW7wenJILJeGndalQwdvMK93pnjle/DN68Zs1jtPnZwd/ds1UyMER4j9EeN
 NrSFodgf0VWijU5VOQEV3nf3x83SykOskv2QIrFk+az2veT0bu8OKiOvCLEB39/0p1
 H3NQ2CMzfAPyweaHUAber0mbMA4mC8HBsgyqBi8zJf2TJa2tyBwzuTjNefiS/NUO2Y
 PUq3OAO2o8ZKw==
Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 28321120205;
 Mon,  4 Jan 2021 12:38:45 -0500 (EST)
In-Reply-To: <877dos50su.fsf@web.de> (Michael Heerdegen's message of "Mon, 04
 Jan 2021 13:44:33 +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:197320
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/197320>

> AFAICT the issue here is that `pcase-let' always creates lexically
> scoped bindings, even for special variables.  That can be surprising.

It's messier than that: the issue is that it doesn't bind variables
which aren't used lexically (this is needed to avoid spurious warnings
about unused vars when the var is used in on place but not in another).

> @Stefan, what can we do?  Document better?  Add compiler warnings?  Or
> is it possible to "fix" this?

We could try and make `pcase` more aware of dyn-scoped vars and have it
refrain from optimizing away "unused" dyn-scoped vars, but maybe it's
better to document it (and maybe even add a warning when a dyn-scoped
var is bound by `pcase`, like we already have for dyn-scoped vars bound
as function arguments).


        Stefan