From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Dealing with obsoletion warnings in non-core code
Date: Mon, 28 Sep 2020 13:32:47 -0400 [thread overview]
Message-ID: <jwvwo0dzucs.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20200928143540.GB1002@odonien.localdomain> (Vasilij Schneidermann's message of "Mon, 28 Sep 2020 16:35:40 +0200")
> The same trick however cannot be used for functions/variables declared
> obsoleted, the only construct I've found to work in this case is the
> following:
>
> (with-suppressed-warnings ((obsolete old-but-useful-function))
> (if (fboundp 'recommended-function)
> (recommended-function)
> (old-but-useful-function)))
>
> Ideally I'd like to be able to write the following instead to avoid the
> needless repetition:
>
> (if (fboundp 'recommended-function)
> (recommended-function)
> (old-but-useful-function))
Indeed, it's a problem of which I'm aware but I don't know how to solve
it nicely. Here's my thoughts about it so far:
I see how I could silence the obsolescence warning for:
(if (fboundp 'old-but-useful-function)
(old-but-useful-function)
(recommended-function))
but that then gives you byte-compile warnings in older Emacsen because
of the use of a `recommended-function` they don't know about, and more
problematically it makes your code keep using the obsolete function even
when the all-dancing-all-singing `recommended-function` is
already available.
I guess we could try and add some kind of database of "replacements", so
when the byte-compiler sees (fboundp 'recommended-function) it knows to
silence warnings for `old-but-useful-function`, but that seems terribly
ad-hoc, will likely only work for some particular cases, and requires
the programmer to be aware of which `recommend-function` to test in
order to silence the warning. Maybe it's still worth doing,
I don't know.
Stefan
next prev parent reply other threads:[~2020-09-28 17:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 14:35 Dealing with obsoletion warnings in non-core code Vasilij Schneidermann
2020-09-28 17:32 ` Stefan Monnier [this message]
2020-09-28 18:16 ` Eli Zaretskii
2020-09-28 18:34 ` Vasilij Schneidermann
2020-09-28 19:00 ` Eli Zaretskii
2020-09-28 19:24 ` Stefan Monnier
2020-09-29 14:07 ` Eli Zaretskii
2020-09-29 8:21 ` Gregory Heytings via Emacs development discussions.
2020-09-29 8:28 ` Gregory Heytings via Emacs development discussions.
2020-09-29 9:33 ` Gregory Heytings via Emacs development discussions.
2020-09-29 13:11 ` Stefan Monnier
2020-09-29 14:11 ` Gregory Heytings via Emacs development discussions.
2020-09-29 14:46 ` Stefan Monnier
2020-09-29 15:36 ` Gregory Heytings via Emacs development discussions.
2020-09-29 14:55 ` T.V Raman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvwo0dzucs.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.