From: Pierre Rouleau <prouleau001@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 49749@debbugs.gnu.org
Subject: bug#49749: 26.3; 26.3 & 27.2: invalid byte compiler warning in short-circuited or form
Date: Sat, 31 Jul 2021 09:59:02 -0400 [thread overview]
Message-ID: <CALTqLiZYoYCfFXdAX6b8SzA9rPDyp61B7RNy7r-=5jc8P+Z_Og@mail.gmail.com> (raw)
In-Reply-To: <8735rycvdr.fsf@gnus.org>
[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]
On Wed, Jul 28, 2021 at 11:26 AM Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Pierre Rouleau <prouleau001@gmail.com> writes:
>
> > (defun f-or ()
> > "Use or."
> > (when (or (null (boundp 'foo))
> > (null foo)) ;=> ``Warning: reference to free variable
> ‘foo’``
> > (message "foo is not set")))
>
> The message about invalid stuff is only discarded if Emacs is trivially
> able to deduce that it'll never be evaluated -- and as you've found out,
> it's easy to make that heuristic not be heeded (see
> `byte-compile-maybe-guarded' for details).
>
Thanks. I must admit I do not know the byte compiler code much at this
point.
> So I'm not sure this is a bug -- Emacs can't determine all cases where
> we won't be executing the code in question at compile time.
>
Well, from the perspective of a user, that would look at the
very least as a technical limitation.
The byte compiler is able to report unused lexical variables.
It's able to report access to unbound symbols in a large
number of code patterns. That helps detect a lot of coding mistakes
and that's very valuable.
It may be difficult, or perhaps even not possible, to prevent the warning
in the situation I reported. If the byte compiler cannot be improve to
handle
this situation, could this scenario be added to the list of know limitations
of the byte-compiler? Maybe someday it will become possible to handle it
and this scenario will help the process?
--
/Pierre
[-- Attachment #2: Type: text/html, Size: 2427 bytes --]
next prev parent reply other threads:[~2021-07-31 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 18:54 bug#49749: 26.3; 26.3 & 27.2: invalid byte compiler warning in short-circuited or form Pierre Rouleau
2021-07-28 15:26 ` Lars Ingebrigtsen
2021-07-31 13:59 ` Pierre Rouleau [this message]
2021-08-01 0:19 ` Michael Heerdegen
2021-08-01 10:26 ` 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='CALTqLiZYoYCfFXdAX6b8SzA9rPDyp61B7RNy7r-=5jc8P+Z_Og@mail.gmail.com' \
--to=prouleau001@gmail.com \
--cc=49749@debbugs.gnu.org \
--cc=larsi@gnus.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 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).