This discussion (as of December 17th) is now arguing a paired delimiter (such as double-angle brackets
⟪...⟫) could offer improved semantics for raw strings, used by regular expressions and other string notations, by negating the need to have complex escaping rules. In this case, the raw string would end when its matching pair is encountered, allowing for nested strings. There will be some strings that cannot be represented, but that would be acceptable for the design since regular double quoted strings have that feature.
Dec 6th this was titled, “Retrieving single-quoted syntax for general purpose use in Julia 2.0”. The original posting follows. Recovering single quote syntax has been resoundingly dismissed. However, the challenge with raw string semantics remains.
One of my disappointments with Julia is that single quotes are reserved for characters, as opposed to being a more generally useful alternative to double quoting. In
SQL, for example, single quotes can be used – where doubling up on a single quote is the only form of escape.
"She said: \"His name is O'Brien\"" == 'She said: "His name is O''Brien"'
I realize in early development, having a succinct mechanism to express characters was convenient, but it’s not particularly common for application or even scientific programming. Instead of a very accessible single-quote syntax, we have
@raw_str semantics, which are hard to grok.
There is a brave way forward. We could introduce a string literal for characters, let’s call it
@c_str anytime soon…
julia> macro c_str(ch) s = unescape_string(ch) @assert length(s) == 1 return s end @c_str (macro with 1 method) julia> c"\n" '\n': ASCII/Unicode U+000A (category Cc: Other, control)
Over time, existing code could be migrated to use this. As someone doing some parsing myself, this isn’t such a huge burden – it’s literally one extra character to type, and this macro could be carried out and type-checked at compile time. Then, one day, we could deprecate use of single-quotes for characters. Then in Julia 2.0, we could use single quotes as a real alternative to places where we don’t want slash escaping, for example, in regular expressions.