GNU bug report logs -
#73526
31.0.50; [FR] warn about unreachable code
Previous Next
To reply to this bug, email your comments to 73526 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73526
; Package
emacs
.
(Sat, 28 Sep 2024 10:25:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eshel Yaron <me <at> eshelyaron.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 28 Sep 2024 10:25:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Feature request: warn about unreachable code in Emacs Lisp.
Unreachable code means Lisp forms that occur in positions that can never
be reached, so these forms are never evaluated. The simplest cases of
unreachable code are code that is only evaluated after some form that
never returns (such no-return forms include signal and throw calls, as
well as while loops with a never-nil test).
Unreachable code often indicates a programmer mistake, and never
improves (or otherwise affects) the program's behavior in any way.
So it's helpful to warn about it. Clang and Go provide such warnings,
for example.
Emacs sources include many occurrences of such unreachable code.
For example, in lisp/mail/uudecode.el we find:
--8<---------------cut here---------------start------------->8---
(cond
(done)
((> 0 remain)
(error "uucode line ends unexpectedly")
(setq done t)) <---- Unreachable!
...)
--8<---------------cut here---------------end--------------->8---
In lisp/gnus/nndir.el we see an example of a clear mistake that produces
easily detectable unreachable code:
--8<---------------cut here---------------start------------->8---
(or err "No such file or directory: %s" nndir-directory)
^ <---- Unreachable!
--8<---------------cut here---------------end--------------->8---
Thanks,
Eshel
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sun, 03 Nov 2024 06:02:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 225 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.