From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 0da97d6: * src/keyboard.c (timer_check_2): Replace redundant test with assertion Date: Sat, 06 Aug 2022 08:42:58 +0300 Message-ID: <83bksyyljx.fsf@gnu.org> References: <83fsiazh5y.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24217"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 06 07:44:37 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oKCc0-00066R-Fl for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Aug 2022 07:44:36 +0200 Original-Received: from localhost ([::1]:32872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKCbz-0003S6-Bq for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Aug 2022 01:44:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKCaP-00022v-KY for emacs-devel@gnu.org; Sat, 06 Aug 2022 01:42:57 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKCaP-0004rQ-AK; Sat, 06 Aug 2022 01:42:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ghBbRPrGdo0IALp2pSI15s0AO0YgRzfB/M1hRx5ntak=; b=RCgj/vNgsKPu 6vSUdqyBonrgl992PGMPgtRzLd8fEYNmRjIrno/pq5EYr4Mj0ml0PnfGAw8a1SAMcCYfzlIN75frs okDd55oK3nkuYxxYPIgTOCm/fkPv7kpkbgefNfeAaiPE62oPkmijpjXALsKHdgg40o4+kCPt7PPzg HkuJtOpQ83nsOaf2irQGsNGbHRo/lrtq1HtdCr5NvWcf6zT9dw+4kQOkaPRgEIgCRkwYZScFf6gt3 bkYRuFVH3+ahYZLyCTGc023g+hvsUVDjwReF7+IRsUG4N3p4uOlHuV4FDDf043Z+jYD/irkQAucyo hfpK3eYTsyU+l+CKixV3bQ==; Original-Received: from [87.69.77.57] (port=3905 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKCaO-0002df-N8; Sat, 06 Aug 2022 01:42:57 -0400 In-Reply-To: (message from Stefan Monnier on Fri, 05 Aug 2022 17:41:00 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:293134 Archived-At: > From: Stefan Monnier > 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.