From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 39169@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#39169: 28.0.50; Confusing obsolete variable warnings in eieio-defclass-autoload
Date: Thu, 27 Aug 2020 17:38:45 -0400 [thread overview]
Message-ID: <jwvft87eppq.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87tuwn7pj8.fsf@web.de> (Michael Heerdegen's message of "Thu, 27 Aug 2020 23:22:03 +0200")
> 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
next prev parent reply other threads:[~2020-08-27 21:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-18 9:57 bug#39169: 28.0.50; Confusing obsolete variable warnings in eieio-defclass-autoload Michael Heerdegen
2020-08-24 20:55 ` Lars Ingebrigtsen
2020-08-25 2:12 ` Stefan Monnier
2020-08-25 20:05 ` Lars Ingebrigtsen
2020-08-25 20:07 ` Lars Ingebrigtsen
2020-08-26 15:30 ` Michael Heerdegen
2020-08-27 13:34 ` Lars Ingebrigtsen
2020-08-27 15:07 ` Michael Heerdegen
2020-08-27 15:23 ` Michael Heerdegen
2020-08-27 21:22 ` Michael Heerdegen
2020-08-27 21:38 ` Stefan Monnier [this message]
2020-12-29 10:59 ` Michael Heerdegen
2021-01-06 16:56 ` Michael Heerdegen
2020-08-28 14:06 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvft87eppq.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=39169@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=michael_heerdegen@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).