GNU bug report logs -
#45619
No warning when pcase-let is binding dynamic variable
Previous Next
Full log
View this message in rfc822 format
Lars Ingebrigtsen [2022-02-12 17:30:54] wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> Hmm... I doubt it's fixed in all cases.
> Here's a more self-contained example:
>
> ;;; -*- lexical-binding: t -*-
>
> (defvar foo 1)
>
> (defun zot ()
> (pcase-let ((`(,foo) '(2)))
> (bar)))
>
> (defun bar ()
> (message "%s" foo))
>
> M-: (zot) messages "2".
I don't think a single example can represent all cases. Try:
(defun zot ()
(pcase-let (((or `(,foo) foo) '(2)))
(progn (bar))))
>> 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.
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.