On Thu, Dec 6, 2012 at 12:14 PM, Rex Kerr <
ich...@gmail.com> wrote:
> String interpolation strings are for now always parsed as literal strings by
> the compiler, save for $-syntax for inserting code; these literal strings
> are then passed on to the interpolating code that can choose to do things
> like interpret escape sequences.
Oh, I see. I mistook this line from the SIP:
alphaid`"' {printableChar \ (`"' | `$') | escape} `"'
for meaning that it's possible to quote double quotes with a backslash
but it actually means that double quotes and dollar signs are
forbidden as literal characters in interpolated strings.
Dollar signs can be quoted as $$, why isn't there a similar quote $" ?
What would have been the disadvantages of just allowing the usual
backslash escapes for double quotes and dollar signs? I understand
that you want to leave as much processing as possible to the
interpolator implementation but when that means that you can't express
some literals to begin with it seems overly restrictive and like a
unnecessary departure from the usual conventions. It makes it harder
to change code to use string interpolation because some forms that are
valid strings are no valid interpolated strings any more.