[Top][All Lists]

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

Re: Raw strings (experimental patches inside)

From: Stephen J. Turnbull
Subject: Re: Raw strings (experimental patches inside)
Date: Sat, 11 Aug 2012 16:27:19 +0900

Stefan Monnier writes:

 > > You still need to *double*-backslash-escape, backslash-escaping is
 > > insufficient.
 > If the special chars don't need to be backslash escaped, then you don't
 > need to double escape either, obviously.

Of course they need to be backslash-escaped, fairly frequently.  I
often search for things like '(foo' and '?\' in Lisp, '{' and '}' in
Python or C, '*' in ReST, etc, because I want to find something in a
particular syntactic context.  There's a reason why basic REs
backslashed some of the basic operators, it wasn't just an epidemic of
early-onset Alzheimer's at Bell Labs.  They were wrong to put weight
on that reason, of course, but they realized their mistake a lot
faster than we Emacs developers did. :-(

It's true that a saner regexp syntax would reduce the need, but only
rawstrings can help with stuff like the regexp needed to find an
end-of-row in LaTeX arrays: "\\\\\\\\".  Those of us with a bit of
astigmatism can't even be sure that's 8 backslashes without careful

 > I don't have rawstring phobia.  I just think it's a workaround which
 > makes Elisp's syntax more complex without fixing the real problem.

Off-by-one error!  The point is that there are *two* problems here.

I don't know if it's a good idea, but you could even fix both with one
syntax.  Ie, when you read a rawstring, the resulting string is
automatically given a "if-you-use-me-as-a-regex-use-pcre-syntax-please"

 > Could it make the syntax slightly better?  Yes.  Would the difference
 > be significant?  I doubt it.

Works-for-me is not a good way to design an Emacs for other people.

BTW, I was -0.5 on rawstrings when they were introduced in XEmacs.  I
was wrong then, and I had better reasons (ie, Emacs compatibility) for
being negative.

reply via email to

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