Why not clojure support raw string?

342 views
Skip to first unread message

Promise.

unread,
Feb 20, 2018, 3:05:16 AM2/20/18
to Clojure
Just like r"" or r""" """ in python.

r"""{"doc":"This is a JSON string."}"""

Andy Fingerhut

unread,
Feb 20, 2018, 3:12:59 AM2/20/18
to clo...@googlegroups.com
Clojure does not have Python's triple-quoted strings, that is true.  Why?  They have only come up a few times before in discussion on this Google group, and Rich Hickey has not participated in them that I have seen, so most likely he may simply not see much advantage to having them in the language, vs. possible backwards-compatibility issues that might arise if they were added.

One of the main uses of raw string literals in Python is to avoid having to use two consecutive backslashes to get on backslash in a string, which is most useful in regular expressions, where backslashes are quite common.  Clojure has regex literals with the syntax #"\d+" which have that feature of Python raw string literals.

Andy

On Mon, Feb 19, 2018 at 10:46 PM, Promise. <qq918...@gmail.com> wrote:
Just like r"" or r""" """ in python.

r"""{"doc":"This is a JSON string."}"""

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages