From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#19208: replace-match unhelpful error message Date: Sat, 03 Aug 2019 22:31:17 +0200 Message-ID: <87imrec7oq.fsf@mouse.gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="100123"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 19208@debbugs.gnu.org, Phillip Lord To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 03 22:32:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hu0hG-000Pvp-7P for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2019 22:32:10 +0200 Original-Received: from localhost ([::1]:41880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hu0hF-0000eo-7n for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2019 16:32:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46532) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hu0h9-0000e1-Ps for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 16:32:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hu0h8-0001Tj-OA for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 16:32:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51210) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hu0h8-0001Tc-LD for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 16:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hu0h8-00028i-Gd for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 16:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 20:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.15648642856374 (code B ref 19208); Sat, 03 Aug 2019 20:32:02 +0000 Original-Received: (at 19208) by debbugs.gnu.org; 3 Aug 2019 20:31:25 +0000 Original-Received: from localhost ([127.0.0.1]:60031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0gX-0001eP-3P for submit@debbugs.gnu.org; Sat, 03 Aug 2019 16:31:25 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:53338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0gV-0001by-33 for 19208@debbugs.gnu.org; Sat, 03 Aug 2019 16:31:23 -0400 Original-Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hu0gQ-0007n2-Bh; Sat, 03 Aug 2019 22:31:20 +0200 In-Reply-To: (Paul Eggert's message of "Sat, 3 Aug 2019 13:22:26 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164488 Archived-At: Paul Eggert writes: >> No, that's just another sanity check -- num_regs is the max allowed >> number of sub-matches. (I've now added some comments to clarify.) > > Unfortunately that patch messes up the sanity check, as the patched > code allows 'sub' to be negative, or to be equal to > search_regs.num_regs, and in either case this results in a bad > pointer. Sorry; thanks for fixing. >> Yoda conditionals and a !... > > Actually those were Leibniz conditionals, which are comparisons > involving "<" or "<=". The idea is that the conditionals' textual > order reflects numeric order. This is a common style in math when > doing range checking, e.g., "0 <= i < n". Yoda conditionals are > expressions like "0 != x" which I agree are confusing. Well, I think both are called Yoda conditionals, and they are demonstrably confusing for people not used to seeing conditionals written that way, which is I think pretty much everybody, except four people working on Emacs. :-) In real life, nobody says "if 62 is less than your age, you're eligible for Medicare". I think one should write code for legibility -- but opinions on what's legible various, of course. Reading "if (62 < age)", for me, requires mental gymnastics. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no