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 10:23:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

> Ouch!  There seems to be a clash between symbols (which are global,
> dynamic) and lexical variables (which are local and "invisible"): the
> only way to mark a variable as lexical is at the global level.

Yes, there are some subtleties there.  The main issue is that every
occurrence of an identifier, whether a binding occurrence or a "use" can
be lexical or dynamic, but we don't want the coders to have to
constantly specify which uses and which bindings are lexical and which
are dynamic.  So we offer ways to "mark" symbols are "this one uses
dynamic scoping".  There are 2 such ways:
- *Evaluation* of (defvar VAR VAL . REST) marks this variable as being
  dynamically scoped in all the code that will be compiled in this session.
- *Compilation* of (defvar VAR . REST) marks this variable as being
  dynamically scoped in the current compilation unit.

> (vi) e (special-variable-p 'edebug-breakpoints).
>
> This last returns nil.  This suggests edebug-breakpoints has been bound
> as a lexical variable, rather than a dynamic one.  (There is a defvar
> for it earlier in the file.)  This is surely not right.

special-variable-p only indicates if (defvar VAR VAL . REST) was evaluated.


        Stefan




reply via email to

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