GNU bug report logs - #45619
No warning when pcase-let is binding dynamic variable

Previous Next

Package: emacs;

Reported by: jixiuf <jixiuf <at> qq.com>

Date: Sun, 3 Jan 2021 09:05:01 UTC

Severity: normal

Found in version 28.0.50

Full log


Message #46 received at 45619 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, jixiuf <jixiuf <at> qq.com>,
 45619 <at> debbugs.gnu.org
Subject: Re: bug#45619: 28.0.50; pcase-let on MacOS doesn't work
Date: Sat, 12 Feb 2022 09:56:37 -0500
Lars Ingebrigtsen [2022-02-12 08:46:02] wrote:
> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>>> (pcase-let ((`(,default-directory) '( "/tmp/")))
>>>     (call-interactively 'find-file))
>>>
>>> Expected behavior: Find file in "/tmp/"
>>> Observed behavior: Find file in "~"
>>
>> AFAICT the issue here is that `pcase-let' always creates lexically
>> scoped bindings, even for special variables.  That can be surprising.
>>
>> @Stefan, what can we do?  Document better?  Add compiler warnings?  Or
>> is it possible to "fix" this?
> I tried the form in Emacs 29, and I got the expected behaviour here.  So
> was this fixed since this bug was reported?  (But I only tested on Debian.)

Hmm... I doubt it's fixed in all cases.
I still think pcase should emit a warning when asked to bind
a dynamically scoped variable.


        Stefan





This bug report was last modified 3 years and 112 days ago.

Previous Next


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