all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	jixiuf <jixiuf@qq.com>,
	45619@debbugs.gnu.org
Subject: bug#45619: 28.0.50; pcase-let on MacOS doesn't work
Date: Sat, 12 Feb 2022 17:33:57 -0500	[thread overview]
Message-ID: <jwvfsonn2gj.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ee480zms.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 12 Feb 2022 18:21:31 +0100")

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






      reply	other threads:[~2022-02-12 22:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03  7:59 bug#45619: 28.0.50; pcase-let on MacOS doesn't work jixiuf
2021-01-04 12:44 ` Michael Heerdegen
2021-01-04 15:41   ` Drew Adams
2021-01-04 17:41   ` Stefan Monnier
2021-01-04 19:50     ` Michael Heerdegen
2021-01-04 20:37       ` Stefan Monnier
2021-01-04 22:08     ` Michael Heerdegen
2021-01-05  2:06       ` Stefan Monnier
2021-01-07 11:38         ` Michael Heerdegen
2021-01-07 15:19           ` Stefan Monnier
2021-01-08 20:05             ` Michael Heerdegen
2021-01-08 22:13               ` Stefan Monnier
2022-02-12  7:46   ` Lars Ingebrigtsen
2022-02-12 14:56     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-12 16:30       ` Lars Ingebrigtsen
2022-02-12 17:10         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-12 17:21           ` Lars Ingebrigtsen
2022-02-12 22:33             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvfsonn2gj.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=45619@debbugs.gnu.org \
    --cc=jixiuf@qq.com \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.