Just curious what’s behind the decision of the Ruby developers to interpret the double-backslash escape sequence inside single quotes. I can understand why an escaped single-quote has to be interpreted because insertion of single-quote character won’t be possible. For example:
'\'' == "'"
But consider '\\' == "\\". Why is this another special case?
In order to end a String with a backslash
The one escape initially needed in hard-quoted strings is
\', as others also note.But the real, fundamental reason why
\\is also needed is because, once\'is supported, it otherwise would not be possible to end a hard-quoted string with a backslash.