GNU bug report logs - #33828
26.1; Unbound defvar across compilation units

Previous Next

Package: emacs;

Reported by: Luís Oliveira <luismbo <at> gmail.com>

Date: Fri, 21 Dec 2018 16:23:02 UTC

Severity: minor

Tags: notabug

Found in version 26.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 33828 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 Luís Borges de Oliveira <luismbo <at> gmail.com>,
 33828 <at> debbugs.gnu.org
Subject: Re: bug#33828: 26.1; Unbound defvar across compilation units
Date: Sun, 23 Dec 2018 01:16:38 +0000
[Message part 1 (text/plain, inline)]
On Sat, Dec 22, 2018 at 10:41 PM Philipp Stephani <p.stephani2 <at> gmail.com>
wrote:

> Am Sa., 22. Dez. 2018 um 03:46 Uhr schrieb João Távora <
> joaotavora <at> gmail.com>:
> >
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> >
> > >> From: Luís Oliveira <luismbo <at> gmail.com>
> > >> Date: Fri, 21 Dec 2018 12:02:55 +0000
> > >> Cc: João Távora <joaotavora <at> 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'.
>

I think in Luís original report there is a `require' of the library where
the variable is declared before using it. Unfortunately it only works
when it is declared with an initial value.

João
[Message part 2 (text/html, inline)]

This bug report was last modified 6 years and 152 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.