unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, 46387@debbugs.gnu.org
Subject: bug#46387: 28.0.50; Compiled code making a variable dynamic stopped working
Date: Tue, 9 Feb 2021 17:49:20 +0100	[thread overview]
Message-ID: <BF1AED06-83CB-4A0D-B8F8-043E56CF3A29@acm.org> (raw)
In-Reply-To: <jwvim71s1m4.fsf-monnier+emacs@gnu.org>

9 feb. 2021 kl. 16.31 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

> Adding a variable to the context creates a new scope.
> A `progn` should not introduce a new scope.

All right, `defvar` modifies the current scope and only let, let* and lambda create new scopes. Fine, but it leaves questions unanswered.

* Does `defvar` affect new bindings only, or variable references in the current scope as well? In

 (let ((my-var EXPR))
   (defvar my-var)
   (use my-var))

does the last line refer to the lexical my-var bound in the first line, or to the dynamic my-var?

* Does the defvar have to be 'executed' to be effective? That's how the interpreter works, but it clearly can't work in the compiler. The defvar form probably has to 'precede' the binding form which it tries to affect, in some way.

> The (with-suppressed-warnings (...) (defvar)) form is used at
> several places.  It's the preferred way to declare a variable
> dynamically scoped without incurring the "not prefixed" warning and
> without making the `with-suppressed-warnings` silencer cover more code
> than intended.

Yes, but it does (currently) work if used on a single variable at a time, which is the suggested workaround for the time being.






  reply	other threads:[~2021-02-09 16:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 17:29 bug#46387: 28.0.50; Compiled code making a variable dynamic stopped working Michael Heerdegen
2021-02-09 10:32 ` Mattias Engdegård
2021-02-09 15:31   ` Stefan Monnier
2021-02-09 16:49     ` Mattias Engdegård [this message]
2021-02-09 18:48       ` Stefan Monnier
2021-02-10  3:20   ` Michael Heerdegen
2021-02-10  8:22     ` Mattias Engdegård
2021-02-10 13:49       ` Mattias Engdegård
2021-02-10 22:44         ` Michael Heerdegen
2021-02-11  8:49           ` Mattias Engdegård

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=BF1AED06-83CB-4A0D-B8F8-043E56CF3A29@acm.org \
    --to=mattiase@acm.org \
    --cc=46387@debbugs.gnu.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).