From: Eli Zaretskii <eliz@gnu.org>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
Subject: Re: Emacs regexp scan (Sep 29)
Date: Sat, 05 Oct 2019 13:49:14 +0300 [thread overview]
Message-ID: <83lftz4gd1.fsf@gnu.org> (raw)
In-Reply-To: <AE7FDD29-D9D0-4C7E-AABB-E889D10C3020@acm.org> (message from Mattias Engdegård on Sat, 5 Oct 2019 11:37:45 +0200)
> From: Mattias Engdegård <mattiase@acm.org>
> Date: Sat, 5 Oct 2019 11:37:45 +0200
> Cc: Paul Eggert <eggert@cs.ucla.edu>, emacs-devel@gnu.org
>
> 5 okt. 2019 kl. 10.10 skrev Eli Zaretskii <eliz@gnu.org>:
>
> > 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.
next prev parent reply other threads:[~2019-10-05 10:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-29 19:39 Emacs regexp scan (Sep 29) Mattias Engdegård
2019-10-04 21:42 ` Paul Eggert
2019-10-05 8:10 ` Eli Zaretskii
2019-10-05 9:37 ` Mattias Engdegård
2019-10-05 10:49 ` Eli Zaretskii [this message]
2019-10-05 15:16 ` Stefan Monnier
2019-10-05 16:02 ` Eli Zaretskii
2019-10-05 9:52 ` Paul Eggert
2019-10-05 10:59 ` Eli Zaretskii
2019-10-05 15:20 ` Stefan Monnier
2019-10-05 16:03 ` Eli Zaretskii
2019-10-06 13:42 ` Stefan Monnier
2019-10-06 18:01 ` Eli Zaretskii
2019-10-05 19:19 ` Paul Eggert
2019-10-05 19:31 ` Eli Zaretskii
2019-10-05 19:50 ` Paul Eggert
2019-10-06 17:19 ` Eli Zaretskii
2019-10-06 17:33 ` Paul Eggert
2019-10-06 18:53 ` Eli Zaretskii
2019-10-06 19:19 ` Paul Eggert
2019-10-06 19:31 ` Eli Zaretskii
2019-10-05 16:59 ` Lars Ingebrigtsen
2019-10-05 18:52 ` Paul Eggert
2019-10-05 10:03 ` Mattias Engdegård
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=83lftz4gd1.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=mattiase@acm.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).