[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs regexp scan (Sep 29)

From: Eli Zaretskii
Subject: Re: Emacs regexp scan (Sep 29)
Date: Sat, 05 Oct 2019 13:49:14 +0300

> From: Mattias EngdegÄrd <address@hidden>
> Date: Sat, 5 Oct 2019 11:37:45 +0200
> Cc: Paul Eggert <address@hidden>, address@hidden
> 5 okt. 2019 kl. 10.10 skrev Eli Zaretskii <address@hidden>:
> > 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

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]