From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: Raw strings (experimental patches inside) Date: Sat, 11 Aug 2012 16:27:19 +0900 Message-ID: <87boihsxbc.fsf@uwakimon.sk.tsukuba.ac.jp> References: <651F6603-F798-4381-929E-7D86A28DBC4D@gmail.com> <502464D6.4000103@gmail.com> <87wr1749m0.fsf@uwakimon.sk.tsukuba.ac.jp> <87r4rehd19.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: dough.gmane.org 1344670053 22562 80.91.229.3 (11 Aug 2012 07:27:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Aug 2012 07:27:33 +0000 (UTC) Cc: Vr Rm , Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 11 09:27:33 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T066b-0001d6-PO for ged-emacs-devel@m.gmane.org; Sat, 11 Aug 2012 09:27:29 +0200 Original-Received: from localhost ([::1]:40772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T066a-0000WF-7d for ged-emacs-devel@m.gmane.org; Sat, 11 Aug 2012 03:27:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T066W-0000W4-Uo for emacs-devel@gnu.org; Sat, 11 Aug 2012 03:27:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T066U-0003PG-T7 for emacs-devel@gnu.org; Sat, 11 Aug 2012 03:27:24 -0400 Original-Received: from mgmt2.sk.tsukuba.ac.jp ([130.158.97.224]:43094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T066U-0003P1-Ct for emacs-devel@gnu.org; Sat, 11 Aug 2012 03:27:22 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt2.sk.tsukuba.ac.jp (Postfix) with ESMTP id C75459707A7; Sat, 11 Aug 2012 16:27:19 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 8694511F88A; Sat, 11 Aug 2012 16:27:19 +0900 (JST) In-Reply-To: X-Mailer: VM 8.0.12-devo-585 under 21.5 (beta31) "ginger" b4715fcbe001 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.158.97.224 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152429 Archived-At: 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 counting. > 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" property. > 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.