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

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

Re: The two-argument form of defvar


From: Philipp Stephani
Subject: Re: The two-argument form of defvar
Date: Sat, 18 Apr 2015 09:25:06 +0000

Maybe there should be a declare-variable function to forward-declare
variables, parallel to declare-function.

Tassilo Horn <address@hidden> schrieb am Do., 19. März 2015 um 16:52 Uhr:

> Nicolas Richard <address@hidden> writes:
>
> >> when looking at the source code of defvar it becomes clear that the
> >> two-argument form
> >>
> >> (defvar foo)
> >>
> >> is a no-op.
> >
> > Not always a no-op. The source code has this comment :
> >     /* A simple (defvar foo) with lexical scoping does "nothing" except
> >        declare that var to be dynamically scoped *locally* (i.e. within
> >        the current file or let-block).  */
> >
> > To reflect the above comment, the docstring has :
> > | The `defvar' form also declares the variable as "special",
> > | so that it is always dynamically bound even if `lexical-binding' is t.
>
> But it doesn't *define* anything.
>
>   (defvar xxx1 1) ;; C-h v xxx1 works
>   (defvar xxx2)   ;; C-h v xxx2<tab> (No matches)
>
> That behavior is a bit unexpected when the docstring says "Define SYMBOL
> as a variable, and return SYMBOL."
>
> Bye,
> Tassilo
>


reply via email to

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