From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Plant Newsgroups: gmane.emacs.devel Subject: Re: Raw string literals in Emacs lisp. Date: Fri, 25 Jul 2014 14:40:06 -0700 Message-ID: References: <871tt9i3f3.fsf@fleche.redhat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c354c2aa0c5104ff0b6a85 X-Trace: ger.gmane.org 1406324622 25609 80.91.229.3 (25 Jul 2014 21:43:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Jul 2014 21:43:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tom Tromey Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 25 23:43:38 2014 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 1XAnH7-0002Th-4X for ged-emacs-devel@m.gmane.org; Fri, 25 Jul 2014 23:43:37 +0200 Original-Received: from localhost ([::1]:56992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAnH6-0006C4-KM for ged-emacs-devel@m.gmane.org; Fri, 25 Jul 2014 17:43:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAnDo-00014F-5a for emacs-devel@gnu.org; Fri, 25 Jul 2014 17:40:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAnDj-0002Cr-Nm for emacs-devel@gnu.org; Fri, 25 Jul 2014 17:40:12 -0400 Original-Received: from mail-la0-f46.google.com ([209.85.215.46]:46584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAnDj-0002BK-DW for emacs-devel@gnu.org; Fri, 25 Jul 2014 17:40:07 -0400 Original-Received: by mail-la0-f46.google.com with SMTP id b8so3534102lan.33 for ; Fri, 25 Jul 2014 14:40:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=FEVezLgbpEIrao0bdYNkjDGoM/tfkqzFgq9DjsQr6+4=; b=f3RvmQ0TOFwGIOSGMnw14buQWFZZRZ3Tk2Gi7TKkGvjFDasnLW/s/Eg4FmB9Qn3leh 5nH1lKjWIx1t2KCukW1BzgvMeyenAM42COBp+q3BggofFbFUc3KgQTLARA8jbkXxTlMh wRxho285tPCtiow6EDdruCUV+yfYrV8WP74qZgzksAaQBQsEjqyAPdOEsSlEnebzh1lL lBF+jwXCKOHkC6XZG0jMGL77MiHrJ1vuL0duRPqWdjkKW++p4q/5FWIl1UzWUhwy4OK7 7jwQa8v4Z9dcxx1LUpX958RKIjRTEC7NLxqk9N9py93/6+8/6KRq4EuowVYE5s4d4Kvc yEUg== X-Gm-Message-State: ALoCoQlWgKi0N73dGUFHr+DrMqenFNmQqoHbgfvCABGhwoOjER1oI24pKd/Az/ug7njbQNlUUbSM X-Received: by 10.152.87.164 with SMTP id az4mr18746002lab.25.1406324406089; Fri, 25 Jul 2014 14:40:06 -0700 (PDT) Original-Received: by 10.112.185.99 with HTTP; Fri, 25 Jul 2014 14:40:06 -0700 (PDT) In-Reply-To: <871tt9i3f3.fsf@fleche.redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.46 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:173156 Archived-At: --001a11c354c2aa0c5104ff0b6a85 Content-Type: text/plain; charset=UTF-8 Although I no longer think the idea is useful, quoted contexts would be very easy to detect and avoid. I think that, and this is the impression I got from skimming that thread, is that raw string literals are: 1. it's only really used for regex 2. it would be better to have a function that adds escapes to regexp strings, rather than make it easier to add them. 3. it would require more work than just updating the reader. This reasoning is solid but I think that it still falls short of justification of avoidance. I can think of a lot of common cases which show number one isn't correct. I think the best case would be for doc strings. It would be a lot nicer to write \[func] each instead of \\[func]. Number two I disagree with on the grounds that I just don't think it's the case. For example, I do not think escaped parens appear significantly more than non-espaced parens, especially when it comes to writing major modes. Additionally, because number one isn't really the case, this reasoning doesn't work out entirely either. Number three is just hogwash, because the "it would require more work than that" argument only works if the additional work is to make the current code handle old cases that have somehow become harder to handle. And this isn't the case. Sure, there will be come cases where old code cannot handle raw strings properly. But people can just file a bug report. -Matt On Fri, Jul 25, 2014 at 1:33 PM, Tom Tromey wrote: > Matthew> What if we assume that any string surrounded immediately by > Matthew> parenthesis is a raw string literal? I'm pretty sure every > Matthew> instance of ("...") is currently illegal, and it would be > Matthew> almost certainly trivial to extend the Emacs' lexer/parser to > Matthew> support it. I can do it myself if everyone thinks this is a > Matthew> good idea. > > That kind of thing is valid in quoted contexts though. > > (defvar whatever '("hi")) > > FWIW there was a previous discussion about raw strings: > > http://comments.gmane.org/gmane.emacs.devel/152132 > > I think this killed the idea: > > http://permalink.gmane.org/gmane.emacs.devel/152155 > > Tom > --001a11c354c2aa0c5104ff0b6a85 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Although I no longer think the idea is useful, quoted cont= exts would be very easy to detect and avoid.
I think that, and this is t= he impression I got from skimming that thread, is that raw string literals = are:
1. it's only really used for regex
2. it would be better to have a f= unction that adds escapes to regexp strings, rather than make it easier to = add them.
3. it would require more work than just updating the reader.
This reasoning is solid but I think that it still falls short of justif= ication of avoidance.
I can think of a lot of common cases which show nu= mber one isn't correct. I think the best case would be for doc strings.= It would be a lot nicer to write \[func] each instead of \\[func].
Number two I disagree with on the grounds that I just don't think it= 9;s the case. For example, I do not think escaped parens appear significant= ly more than non-espaced parens, especially when it comes to writing major = modes. Additionally, because number one isn't really the case, this rea= soning doesn't work out entirely either.

Number three is just hogwash, because the "it would require more w= ork than that" argument only works if the additional work is to make t= he current code handle old cases that have somehow become harder to handle.= And this isn't the case. Sure, there will be come cases where old code= cannot handle raw strings properly. But people can just file a bug report.=

-Matt


On Fri, Jul 25, 2014 at 1:33 PM, Tom Tromey <<= a href=3D"mailto:tromey@redhat.com" target=3D"_blank">tromey@redhat.com= > wrote:
Matthew> What if we assume that any strin= g surrounded immediately by
Matthew> parenthesis is a raw string literal? I'm pretty sure every<= br> Matthew> instance of ("...") is currently illegal, and it woul= d be
Matthew> almost certainly trivial to extend the Emacs' lexer/parser = to
Matthew> support it. I can do it myself if everyone thinks this is a
Matthew> good idea.

That kind of thing is valid in quoted contexts though.

(defvar whatever '("hi"))

FWIW there was a previous discussion about raw strings:

http://comments.gmane.org/gmane.emacs.devel/152132

I think this killed the idea:

http://permalink.gmane.org/gmane.emacs.devel/152155

Tom

--001a11c354c2aa0c5104ff0b6a85--