emacs-devel
[Top][All Lists]
Advanced

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

Re: defvar without value


From: Stefan Monnier
Subject: Re: defvar without value
Date: Tue, 31 Mar 2020 20:59:17 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Using `defvar' (on top-level) without specifying a value differs in two
> ways from calls that specify a value: (1) the variable's value is not
> set, and (2) the variable is made special only in the context of the
> (rest of the) current file or buffer.
>
> I wonder if it is good that these two things are chained together, and
> if there are alternatives to what we have now.

I guess we could add something like (defvar-dynamic VAR) which sets the
`special` bit on the variable, just like (defvar VAR VAL) does, but
leaves the variable's value unchanged (currently, you'd have to do
(progn (defvar VAR 'dummy) (makunbound 'VAR)) to get a similar effect).

Similarly, we could add something like (defvar-lexical VAR VAL) which
defines the var and sets it but doesn't set the `special` bit
(currently, we have `internal-make-var-non-special` to serve the same
need).


        Stefan




reply via email to

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