unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Tom Tromey <tom@tromey.com>
Cc: 18971@debbugs.gnu.org
Subject: bug#18971: 25.0.50; incorrect warning from byte compiler
Date: Thu, 06 Nov 2014 18:27:10 -0500	[thread overview]
Message-ID: <jwv1tpfncdf.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87h9ycuyan.fsf@tromey.com> (Tom Tromey's message of "Thu, 06 Nov 2014 08:46:40 -0700")

> I want to be able to call byte-optimize-form and was under the
> impression that byte-compile-close-variables was needed.  I'm doing this
> for a project I'm working on where it is convenient to let the byte
> compiler code macroexpand a form and do some simple optimizations on it.

Just curious: why do you need those simple optimizations performed by
byte-optimize-form?

> I guess I don't understand why this would not be a bug, though.
> Or at least it perplexes me why this happens; my only theory is that
> somehow the defvars aren't seen when byte-compiling my file.  I suppose
> if I wanted to export a macro like this, I would need it to come with
> special declarations for the variables?  Except I didn't see a way to do
> that either.

Those vars are not globally bound, i.e. they are only declared with
(defvar <var>) and this only affects the file in which they appear (or
even the scope, in case they appear within a defun body).

So the macro would need to expand to something like

   (progn
     (defvar byte-compile-free-assignments)
     ...
     (defvar byte-compile-free-references)
     (let (...) ...))

if it was meant to be used outside of bytecomp.el.


        Stefan





  reply	other threads:[~2014-11-06 23:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06  4:14 bug#18971: 25.0.50; incorrect warning from byte compiler Tom Tromey
2014-11-06 15:29 ` Stefan Monnier
2014-11-06 15:46   ` Tom Tromey
2014-11-06 23:27     ` Stefan Monnier [this message]
2014-12-29 19:40       ` Tom Tromey
2014-12-30  2:48         ` Stefan Monnier
2019-06-12 15:11           ` Lars Ingebrigtsen

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=jwv1tpfncdf.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=18971@debbugs.gnu.org \
    --cc=tom@tromey.com \
    /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).