bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18059: 24.3.92; defvar and special variables


From: Michael Heerdegen
Subject: bug#18059: 24.3.92; defvar and special variables
Date: Sun, 11 Feb 2018 02:32:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Noam Postavsky <address@hidden> writes:

> Right, because the defvar is not inside any let-block, so it applies to
> the rest of the file.
>
> Compare
>
>     ;; -*- lexical-binding: t -*-
>
>     (progn
>       (defvar x))
>
>     (let ((x 1))
>       (setq testfun (lambda () x)))
>
>     (message "%S" (funcall testfun))
>
> vs
>
>     ;; -*- lexical-binding: t -*-
>
>     (let (_)
>       (defvar x))
>
>     (let ((x 1))
>       (setq testfun (lambda () x)))
>
>     (message "%S" (funcall testfun))

Thanks for the examples.  Maybe - and this is my personal opinion - such
examples in the manual would not be too bad.  I find the issue hard to
understand without such examples, though it might be a secondary
subject.


> I noticed doing (let () (defvar x)) seems to be the same as (progn
> (defvar x)), which may be a bug.

I guess because the interpreter doesn't create a new lexical environment
in this case?  But indeed it seems to contradict the doc.


Michael.





reply via email to

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