This is a pre SIP to suggest allowing the escape sequence
$" for a
" character in interpolations.
It’s rather cumbersome to write a single quote character in an interpolation. That’s annoying. This proposal fixes that.
- Why use
$as an escape character?
Because that’s the only character that’s significant to the parse of an interpolation. Since the
" normally terminates the parse, but “normal” escapes get processed by the interpolator rather than the parser, only $ usually influences the initial parse.
In addition, this can’t break anyone’s code, since
$" in an interpolation right now is a parse error.
- Why not use
\as an escape character?
Because the interpolator is responsible for processing escapes, it would be inconsistent for the parser to process the
\ only as an escape for a preceding
". Various proposals around this have made the rounds, and it has been found very controversial at least. The implementation also seems somewhat hairy.
- Could this be part of something more ambitious?
Yes. I don’t have that ambition though. Of all the proposals around interpolations and escapes I’ve read so far, this proposal breaks none of them.