[Top][All Lists]

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

bug#18059: 24.3.92; defvar and special variables

From: Noam Postavsky
Subject: bug#18059: 24.3.92; defvar and special variables
Date: Sun, 11 Feb 2018 10:35:22 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I noticed doing (let () (defvar x)) seems to be the same as (progn
>> (defvar x)), which may be a bug.
> Both interpretations would make sense, so given the lack of
> documentation about the intention, we could consider it as a feature as
> much as a bug.
> Have you checked whether the behavior is the same with the
> byte-compiler?

Yes, it's the same.

I see that a lambda form scopes the defvar even if it has no parameters
though.  I.e., the following prints 1:

    ;; -*- lexical-binding: t -*-

    (lambda ()
      (defvar x))

    (let ((x 1))
      (setq testfun (lambda () x)))

    (message "%S" (funcall testfun))

reply via email to

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