[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 <npostavs@users.sourceforge.net> 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.
- bug#18059: 24.3.92; defvar and special variables, Noam Postavsky, 2018/02/10
- bug#18059: 24.3.92; defvar and special variables, Michael Heerdegen, 2018/02/10
- bug#18059: 24.3.92; defvar and special variables, Drew Adams, 2018/02/10
- bug#18059: 24.3.92; defvar and special variables, Noam Postavsky, 2018/02/10
- bug#18059: 24.3.92; defvar and special variables, Stefan Monnier, 2018/02/11
- bug#18059: 24.3.92; defvar and special variables, Noam Postavsky, 2018/02/11
- bug#18059: 24.3.92; defvar and special variables, Michael Heerdegen, 2018/02/11
- bug#18059: 24.3.92; defvar and special variables, Noam Postavsky, 2018/02/11
- bug#18059: 24.3.92; defvar and special variables, Noam Postavsky, 2018/02/13
- bug#18059: 24.3.92; defvar and special variables, Noam Postavsky, 2018/02/18
- bug#18059: 24.3.92; defvar and special variables, Michael Heerdegen, 2018/02/18
- bug#18059: 24.3.92; defvar and special variables, Noam Postavsky, 2018/02/21
- bug#18059: 24.3.92; defvar and special variables, Drew Adams, 2018/02/21