GNU bug report logs -
#55914
28.1; Defining as dynamic an already lexical var
Previous Next
Full log
Message #17 received at 55914 <at> debbugs.gnu.org (full text, mbox):
Hendrik Tews <hendrik.tews <at> kernkonzept.com> writes:
> The elisp manual 28.1 says in 12.5 Defining Global Variables:
>
> If SYMBOL is already lexically bound (e.g., if the ‘defvar’ form
> occurs in a ‘let’ form with lexical binding enabled), then ‘defvar’
> sets the dynamic value.
>
>>From this I would conclude that the error is a bug. Or did I
> overlook something in the documentation?
There's been some back and forth about what happens in these cases.
This section in the manual currently reads (in Emacs 29):
---
If @var{symbol} is already let bound (e.g., if the @code{defvar}
form occurs in a @code{let} form), then @code{defvar} sets the toplevel
default value, like @code{set-default-toplevel-value}.
---
However, your test case signals an error, so I think the documentation
needs further clarifications here:
(let ((test-var nil))
(eval '(defvar test-var t "XXX")))
I've added Stefan to the CCs.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 3 years and 3 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.