From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#59057: Emacs 29. Byte compiler sometimes forgets about a defvar. Date: Wed, 9 Nov 2022 13:40:57 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30101"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59057@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 09 14:42:29 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oslLY-0007fa-6d for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Nov 2022 14:42:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oslLE-0005Ou-FQ; Wed, 09 Nov 2022 08:42:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oslLA-0005Km-7c for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2022 08:42:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oslL8-0001fN-VT for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2022 08:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oslL8-0003I3-Qu for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2022 08:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Nov 2022 13:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59057 X-GNU-PR-Package: emacs Original-Received: via spool by 59057-submit@debbugs.gnu.org id=B59057.166800127112556 (code B ref 59057); Wed, 09 Nov 2022 13:42:02 +0000 Original-Received: (at 59057) by debbugs.gnu.org; 9 Nov 2022 13:41:11 +0000 Original-Received: from localhost ([127.0.0.1]:39315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oslKI-0003GS-JU for submit@debbugs.gnu.org; Wed, 09 Nov 2022 08:41:10 -0500 Original-Received: from mx3.muc.de ([193.149.48.5]:54324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oslKE-0003Fg-1K for 59057@debbugs.gnu.org; Wed, 09 Nov 2022 08:41:09 -0500 Original-Received: (qmail 77014 invoked by uid 3782); 9 Nov 2022 14:40:59 +0100 Original-Received: from acm.muc.de (p4fe1582d.dip0.t-ipconnect.de [79.225.88.45]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 09 Nov 2022 14:40:59 +0100 Original-Received: (qmail 6919 invoked by uid 1000); 9 Nov 2022 13:40:57 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247409 Archived-At: Hello, Stefan. On Mon, Nov 07, 2022 at 16:31:32 -0500, Stefan Monnier wrote: > >> (defvar VAR) does not "create a variable". > > According to both its doc string and the Elisp manual it does. > BTW, what I'm describing is how things have worked in `lexical-binding` > since Emacs-24, basically. A few corner cases didn't quite obey it > (and I'm sure there are still a few remaining ones), but by and large > this is how it has worked for the last 10 years. OK, I see that now, having checked git logs and git blame. There was a bug report in 2018 about the documentation, which Noam Postavsky fixed. 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. 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. Because defvar isn't a single function, it's impossible to document it coherently without explicitly saying it's two functions. I doubt the powers that be would countenance such explicitness. So the documentation will continue to be confusing, and people like me will continue to lose time sorting out what this hybrid function does. I will alter the code in CC Mode which gave rise to this bug report. > Stefan -- Alan Mackenzie (Nuremberg, Germany).