emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't M-x compile-defun `edebug' because dynamic variables are false


From: Stefan Monnier
Subject: Re: Can't M-x compile-defun `edebug' because dynamic variables are falsely taken as lexical.
Date: Wed, 04 Jan 2017 17:26:53 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>> In which context do you need/want to do that (I ask because how to do
>> it (and even if it can be done) depends on the details)?
> I honestly don't know.  I presume that there will be code (other than
> the byte compiler) which will want to make a distinction.

There might, indeed, but it's very rare: in most cases rather than
determining which kind of binding will happen, you want to decide/impose
which binding will happen.

I'm not sure how Common-Lip handles it, but AFAICT there is no
equivalent to special-variable-p there, so they don't seem to offer
a way to find out whether a binding will be lexical or dynamic.

> After (defvar foo), the byte compiler seems able to handle foo as
> a dynamic variable.  I'm still trying to figure out how,

The byte-compiler *sees* the defvar, which lets it keep a note
internally (in a data-structure which keeps track of the current
context, which also includes information about which vars that are
let-bound in the surrounding code were bound lexically, so as to know
when we see a reference to var `foo' whether we should look for `foo' in
the dynamic context or in the lexical context (and if so, where in that
context)).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]