unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 0da97d6: * src/keyboard.c (timer_check_2): Replace redundant test with assertion
@ 2022-08-05 18:20 Eli Zaretskii
  2022-08-05 21:41 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2022-08-05 18:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

IMNSHO, this change is dangerous: it replaces run-time conditions with
assertions, but IME most if not all of the active developers and
people who track the master branch don't compile with --enable-checking,
or don't run the trunk build on a regular basis.  Which means these
assertions, if they happen, will not be seen nor reported.

So basically you removed a safety net without any replacement.

I suggest to revert this change.  It gains us nothing of importance.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 0da97d6: * src/keyboard.c (timer_check_2): Replace redundant test with assertion
  2022-08-05 18:20 master 0da97d6: * src/keyboard.c (timer_check_2): Replace redundant test with assertion Eli Zaretskii
@ 2022-08-05 21:41 ` Stefan Monnier
  2022-08-06  5:42   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2022-08-05 21:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii [2022-08-05 21:20:09] wrote:
> IMNSHO, this change is dangerous: it replaces run-time conditions with
> assertions, but IME most if not all of the active developers and
> people who track the master branch don't compile with --enable-checking,
> or don't run the trunk build on a regular basis.  Which means these
> assertions, if they happen, will not be seen nor reported.
>
> So basically you removed a safety net without any replacement.
>
> I suggest to revert this change.  It gains us nothing of importance.

I introduced a bug in my code which made the test fail, which made me
discover that:
- the test currently can never fail (because the code that leads to this
  point checks the condition earlier).
- if the test were to fail, Emacs would lock up in an inf-loop.
I kept an `eassert` basically to document the assumption.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 0da97d6: * src/keyboard.c (timer_check_2): Replace redundant test with assertion
  2022-08-05 21:41 ` Stefan Monnier
@ 2022-08-06  5:42   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2022-08-06  5:42 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Fri, 05 Aug 2022 17:41:00 -0400
> 
> Eli Zaretskii [2022-08-05 21:20:09] wrote:
> > IMNSHO, this change is dangerous: it replaces run-time conditions with
> > assertions, but IME most if not all of the active developers and
> > people who track the master branch don't compile with --enable-checking,
> > or don't run the trunk build on a regular basis.  Which means these
> > assertions, if they happen, will not be seen nor reported.
> >
> > So basically you removed a safety net without any replacement.
> >
> > I suggest to revert this change.  It gains us nothing of importance.
> 
> I introduced a bug in my code which made the test fail, which made me
> discover that:
> - the test currently can never fail (because the code that leads to this
>   point checks the condition earlier).
> - if the test were to fail, Emacs would lock up in an inf-loop.

I'm not against the assertions, I'm against replacing run-time
conditions with assertions.  You can keep the assertion of you
reinstate the conditional, if it is important to you to flag when
these conditions happen.

> I kept an `eassert` basically to document the assumption.

There's no assumption here, not one that we want to bet our user's
session fate on.  We want to prevent bad, perhaps fatal, errors when
that condition is violated.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-06  5:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 18:20 master 0da97d6: * src/keyboard.c (timer_check_2): Replace redundant test with assertion Eli Zaretskii
2022-08-05 21:41 ` Stefan Monnier
2022-08-06  5:42   ` Eli Zaretskii

Code repositories for project(s) associated with this 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).