emacs-devel
[Top][All Lists]
Advanced

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

Re: Raw string literals in Emacs lisp.


From: Matthew Plant
Subject: Re: Raw string literals in Emacs lisp.
Date: Fri, 25 Jul 2014 14:40:06 -0700

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 <address@hidden> 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


reply via email to

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