GNU bug report logs - #59057
Emacs 29. Byte compiler sometimes forgets about a defvar.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 5 Nov 2022 18:47:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Alan Mackenzie <acm <at> muc.de>, 59057 <at> debbugs.gnu.org
Subject: bug#59057: Emacs 29. Byte compiler sometimes forgets about a defvar.
Date: Thu, 24 Nov 2022 11:29:32 -0800
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> The basic problem is that defvar is a dog's breakfast of a function.  In
>> fact, it's two distinct functions sharing a name.  These two functions
>> have little else to do with eachother.
>
> Yup.
>
>> And defvar appears to be the only function in Emacs where supplying nil
>> as an &optional argument has an effect different from omitting it.  This
>> is bad for anybody trying to learn Emacs Lisp.
>
> Not the only one, sadly (`declare-function` comes to mind :-)), but yes,
> it's unusual.

I guess defvar will have to stay as it is.  But would it make sense to
add a new `declare-variable' function, and then document the form

    (defvar <foo>)

to be considered deprecated?




This bug report was last modified 2 years and 262 days ago.

Previous Next


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