unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: FACE_FROM_ID vs FACE_OPT_FROM_ID
Date: Fri, 24 Jun 2016 23:34:56 +0200	[thread overview]
Message-ID: <576DA780.4080801@cs.ucla.edu> (raw)
In-Reply-To: <83twgi1z4m.fsf@gnu.org>

On 06/24/2016 03:43 PM, Eli Zaretskii wrote:
> When ENABLE_CHECKING is not defined, which is what happens by default
> in Emacs builds, we attempt to "do the best we can without crashing",
No, assertions should be always true; if an assertion fails Emacs should 
just abort, and should not try to patch around the bug. This is the 
longstanding intent of assertions, both in Emacs and in traditional 
computer science. If X is a side-effect-free expression, then after an 
eassert (X) there is no point to testing whether X is true, because X is 
already known to be true. The code 'eassert (X); if (!X) foo (X);' is 
redundant and somewhat silly, just as the code 'while (X) if (!X) foo 
(X);' is redundant and somewhat silly.

I suppose Emacs could have a different kind of check, for an expression 
that must be true when debugging but that might not be true in 
production. We could call it 'check_when_debugging (X)', say. Its 
semantics would be that Emacs aborts when debugging is enabled and X is 
false; but that X might be either true or false in production code.

However, I don't think check_when_debugging (X) would be helpful. Unlike 
eassert (X), it won't help the reader or simplify later code, because 
later code won't be able to assume that X is true. Worse, it would cause 
Emacs behavior in debugging mode to diverge further from production 
mode, and the production-only code paths would not be easily debuggable. 
The whole thing would be considerably more confusing than what Emacs 
does now.

It could be that the font and image caches are special cases that have a 
lot of bugs, and that we therefore want some sort of belt-and-suspenders 
treatment for them that goes beyond ordinary assertions. I don't see 
offhand why that would be, though. Are we getting an unusual number of 
bugs in that area, and if so what sort of bugs are they?



  reply	other threads:[~2016-06-24 21:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 20:03 FACE_FROM_ID vs FACE_OPT_FROM_ID Eli Zaretskii
2016-06-24  0:23 ` Paul Eggert
2016-06-24  8:49   ` Eli Zaretskii
2016-06-24  9:27     ` Paul Eggert
2016-06-24  9:57       ` Eli Zaretskii
2016-06-24 10:00       ` Eli Zaretskii
2016-06-24 11:17         ` Paul Eggert
2016-06-24 13:43           ` Eli Zaretskii
2016-06-24 21:34             ` Paul Eggert [this message]
2016-06-25  7:48               ` Eli Zaretskii
2016-06-25 21:34                 ` Paul Eggert
2016-07-02  9:50                   ` Eli Zaretskii

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=576DA780.4080801@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --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 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).