From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Emacs regexp scan (Sep 29) Date: Sat, 05 Oct 2019 13:49:14 +0300 Message-ID: <83lftz4gd1.fsf@gnu.org> References: <1697CA97-B2E6-4202-B14D-99DCF93954FD@acm.org> <02405f0d-788f-1b87-0269-b06eb2d67ff8@cs.ucla.edu> <83zhif4nq6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="9710"; mail-complaints-to="usenet@blaine.gmane.org" Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 05 12:50:00 2019 Return-path: Envelope-to: ged-emacs-devel@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 1iGhdQ-0002On-8n for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 12:50:00 +0200 Original-Received: from localhost ([::1]:55628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGhdO-00088N-Vx for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 06:49:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43471) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGhcq-00086v-T3 for emacs-devel@gnu.org; Sat, 05 Oct 2019 06:49:25 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iGhcq-0007JZ-PF; Sat, 05 Oct 2019 06:49:24 -0400 Original-Received: from [176.228.60.248] (port=4699 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iGhcq-00060H-3j; Sat, 05 Oct 2019 06:49:24 -0400 In-reply-to: (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 5 Oct 2019 11:37:45 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240609 Archived-At: > From: Mattias EngdegÄrd > Date: Sat, 5 Oct 2019 11:37:45 +0200 > Cc: Paul Eggert , emacs-devel@gnu.org > > 5 okt. 2019 kl. 10.10 skrev Eli Zaretskii : > > > If the regexp scanner needs to be pacified, isn't it better to fix the > > scanner instead? > > The check is there because it is often useful. Relint/xr has been detecting and complaining about non-escaped use of special characters such as +, *, ?, ^ and $ for some time now, and for good reason: it's an error-prone exploitation of a hole in the syntax. We think that "*.^" is better written "\\*.\\^" because the latter is more regular, less likely to break when modified, and tells the reader that no, it isn't a mistake, the programmer knows what he is doing. > > Such non-essential escaping has been added many times before, and it has never been controversial in the slightest. I'm not sure I understand: is there a technical reason for producing what sounds like a false positive in these cases, or is this done with some principle in mind? If the latter, what is the underlying principle? In general, I'd rather we didn't flag valid constructs if we can, as doing that is an annoyance for programmers. In particular, I find nothing wrong with "*.^", and I find "\\*.\\^" harder to read. > > I also don't think I see the simplification here. In fact, the > > original code looks simpler to me than the new one, as the former is > > just a simple while loop, whereas the latter is a nested dolist. > > Actually the original was a nested pair of while loops, which indicates that it wasn't quite that simple. It's quite simple when I read it. So this appears to be a stylistic preference again.