[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33828: 26.1; Unbound defvar across compilation units
From: |
Philipp Stephani |
Subject: |
bug#33828: 26.1; Unbound defvar across compilation units |
Date: |
Sat, 22 Dec 2018 23:40:50 +0100 |
Am Sa., 22. Dez. 2018 um 03:46 Uhr schrieb João Távora <joaotavora@gmail.com>:
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Luís Oliveira <luismbo@gmail.com>
> >> Date: Fri, 21 Dec 2018 12:02:55 +0000
> >> Cc: João Távora <joaotavora@gmail.com>
> >>
> >> I think I've come across a bug.
> >
> > Doesn't look like a bug to me.
>
> Indeed, it's the behaviour described in the Emacs manual, but the
> motivation is questionable: it says it's useful for shooshing the
> byte-compiler's warnings. Aren't there better alternatives to do this
> instead of imposing this seeming inconsistency?
The better alternative is to explicitly `require' the library that
defines the variable.
I see the one-argument `defvar' as the variable equivalent to
`declare-function' - it announces that a variable exists without
defining it. (Maybe there should be a `declare-variable' macro to
mirror `declare-function'.) As such, its use should be exceptional;
most libraries should make sure to not have cyclic dependencies and
use plain `require'.