You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, backslashes inside a %w() string array literal may escape whitespaces and the literal delimiters: (contrast with #5403 where %q() cannot escape its own delimiters)
%w(\ \\)\() # => [" \n)("]
However, backslashes here also indefinitely extend an escape sequence, and one \ is written for every extra backslash:
Consequently, it is not possible to use a backslash at the very end of an array, as any number of \s followed by the end delimiter merely escapes that delimiter:
I think we should follow suit and make \ escape only the following character. Like #5403, however, we should decide whether this would constitute a breaking change.
The text was updated successfully, but these errors were encountered:
Currently, backslashes inside a
%w()
string array literal may escape whitespaces and the literal delimiters: (contrast with #5403 where%q()
cannot escape its own delimiters)However, backslashes here also indefinitely extend an escape sequence, and one
\
is written for every extra backslash:Consequently, it is not possible to use a backslash at the very end of an array, as any number of
\
s followed by the end delimiter merely escapes that delimiter:%w(\) # Error: Unterminated string array literal
Here are the same literals in Ruby:
I think we should follow suit and make
\
escape only the following character. Like #5403, however, we should decide whether this would constitute a breaking change.The text was updated successfully, but these errors were encountered: