-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Continued from #659.
Currently, the Slice compiler handles escape sequences like NodeJS does.
If it sees a backslash in a string literal, we remove the backslash and the character immediately after it gets kept as a literal character.
For instance: [deprecated("This is bad, use \"Foo\" instead.")]
.
This works perfectly for the two cases Slice cares about: \"
-> "
and \\
-> \
,
and is consistent with how we support escaping keywords for identifiers: \struct
-> struct
.
But it leaves other cases that might be surprising to some users:
\n
-> n
(instead of a newline character)
\p
-> p
(it's useless to escape p here)
Should we emit an error/warning when users do this explaining the Slice behavior?
Or should we alter the Slice behavior to handle these differently?
I think the current behavior is fine (NodeJS does it, and it's consistent with identifiers),
but I open this issue to discuss alternatives.