From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#39169: 28.0.50; Confusing obsolete variable warnings in eieio-defclass-autoload Date: Thu, 27 Aug 2020 17:38:45 -0400 Message-ID: References: <87tv4txf23.fsf@web.de> <87h7srg3x6.fsf@gnus.org> <87bliy4hkp.fsf@gnus.org> <871rjt5sr3.fsf@web.de> <87h7sow6tp.fsf@gnus.org> <87364886ve.fsf@web.de> <87y2m06rkw.fsf@web.de> <87tuwn7pj8.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9452"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39169@debbugs.gnu.org, Lars Ingebrigtsen To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 27 23:39:10 2020 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 1kBPbx-0002Kh-Gf for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 23:39:09 +0200 Original-Received: from localhost ([::1]:47250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBPbw-00037O-1w for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 17:39:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBPbq-000373-7z for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 17:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBPbp-0000gk-VH for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 17:39:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kBPbp-0002yl-S9 for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 17:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Aug 2020 21:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39169 X-GNU-PR-Package: emacs Original-Received: via spool by 39169-submit@debbugs.gnu.org id=B39169.159856433811442 (code B ref 39169); Thu, 27 Aug 2020 21:39:01 +0000 Original-Received: (at 39169) by debbugs.gnu.org; 27 Aug 2020 21:38:58 +0000 Original-Received: from localhost ([127.0.0.1]:44336 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBPbm-0002yS-2i for submit@debbugs.gnu.org; Thu, 27 Aug 2020 17:38:58 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48401) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBPbh-0002y9-W9 for 39169@debbugs.gnu.org; Thu, 27 Aug 2020 17:38:57 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 601A04408E4; Thu, 27 Aug 2020 17:38:48 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B72E14408BE; Thu, 27 Aug 2020 17:38:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1598564326; bh=q9F/dpeMmPoFQnrUp1WuMGX++lvcUpxBwTk3n2soX00=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RM0vnehtfnuZwQXdVYG986K2p+YLuIvA4MCbxxHnlVe/+yEuilui1a3eZgyC8byHd aHBEMHJgeh6KBlpczrh8ZvBaQARun2K5TfwdpKyW4DSKd3dbNY5xLYVFGESRc8S/EH ZWouir1vwK8hE14P+tno0TPPnikLR7bQqR2llVOPOBvxDBpkdKR/BRIRGeBFx0cl5V wOr8aAmCh3Qy7oCr5zIbKGtz+qCPVQI2gd8QlI7n2DrIj4TxKydnPyBHz8vmnk8P6/ x0Zn2K4/7dDt5EOFWqT+oadXdwtgROVt8H6vbJinF4YKlO9xILc8ZhRmus1Gz41JHO UZXAlUNjO0YBw== Original-Received: from alfajor (unknown [45.72.232.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 86474120255; Thu, 27 Aug 2020 17:38:46 -0400 (EDT) In-Reply-To: <87tuwn7pj8.fsf@web.de> (Michael Heerdegen's message of "Thu, 27 Aug 2020 23:22:03 +0200") 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" Xref: news.gmane.io gmane.emacs.bugs:186573 Archived-At: > Note that I didn't check whether this actually (and always) works: The > problematic obsolete variable declaration is performed in the function > `eieio-defclass-autoload'. If the value of > `eieio-backward-compatibility' is checked when loading autoload > definitions, will a file local binding in the source library be > considered at all? Good question. I did not pay attention to non-global values of `eieio-backward-compatibility` when writing that code, so I don't know whether it would work well (or at all). >> Oh, and let me add another important aspect: why does using an obsolete >> name as the name of a _lexical_ variable trigger the "variable is >> obsolete" warning at all? If that would not be the case (and I don't >> think it is useful) then in source files using lexical binding mode we >> would not see the problem. > > Would doing something like this make sense? > > diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el > index 966990bac9..418070fabe 100644 > --- a/lisp/emacs-lisp/bytecomp.el > +++ b/lisp/emacs-lisp/bytecomp.el > @@ -3357,6 +3357,7 @@ byte-compile-check-variable > (and od > (not (memq var byte-compile-not-obsolete-vars)) > (not (memq var byte-compile-global-not-obsolete-vars)) > + (not (memq var byte-compile-lexical-variables)) > (or (pcase (nth 1 od) > ('set (not (eq access-type 'reference))) > ('get (eq access-type 'reference)) Yes! > BTW, while I looked at this, I found this spurious lookup in > `byte-compile-lexical-variables': > > #+begin_src emacs-lisp > (defun byte-compile-form (form &optional for-effect) > (let ((byte-compile--for-effect for-effect)) > (cond > ((not (consp form))..10..) > ((symbolp (car form)) > (let* ((fn (car form))..4..) > (when (memq fn '(set symbol-value run-hooks..4..) > (pcase (cdr form) > (`(',var . ,_) > (when (assq var byte-compile-lexical-variables) ;; <--- here > (byte-compile-report-error > (format-message "%s cannot use lexical var `%s'" fn var))) > ...))))))))) > #+end_src > > shouldn't the `assq' be `memq'? I think you're right. Both changes should ideally come with corresponding regression tests. Stefan