The state of string interpolation...one year later
Patrick Schluter
Patrick.Schluter at bbox.fr
Mon Mar 18 17:16:33 UTC 2019
On Monday, 18 March 2019 at 16:48:59 UTC, H. S. Teoh wrote:
> On Mon, Mar 18, 2019 at 04:30:26PM +0000, Meta via
> Digitalmars-d wrote:
>> On Monday, 18 March 2019 at 09:07:26 UTC, Olivier FAURE wrote:
>> > On Sunday, 17 March 2019 at 06:01:35 UTC, Jonathan Marler
>> > wrote:
>> > > https://github.com/dlang/dmd/pull/7988
>> >
>> > By the way, quick question, how does the PR handle this case?
>> >
>> > i"$a $b" ~ i$"c $d"
>>
>> Also, recursive use of interpolated strings. Does this work or
>> fail with a compiler error like "can't find symbol c":
>>
>> int a = 2, b = 5;
>> enum code = text(i"mixin(\"int c = $(a + b)\"); writeln(i\"a =
>> $a, b =
>> $b, c = $c\");");
>> mixin(code);
> [...]
>
> I'd expect you'd have to escape the $ in the nested
> interpolated string. I forgot what the escape was, perhaps `$$`?
>
\$ would be consistent with normal C and D quoting rules. $$ not
so much.
More information about the Digitalmars-d
mailing list