Interpolated strings

Jonas Drewsen via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 15 13:04:13 PDT 2017


Hi all

   I've been wanting to have support for interpolated strings in D 
for some time now that will allow you to write e.g.:

auto a = 7;
writeln( $"{a} times 3 is {a*3}" );

Code speaks louder that words so I've made a PR that adds this 
support to ddmd as a RFC [1].

The compiler will basically lower the $"..." string to a mixin 
that concatenates
the expression parts of the (inside the {}) and the plain text 
parts.

I do recognize that this is not part of the 2017 H1 plan but I 
also believe such smaller improvements added regularly can make 
the language both more productive and attractive.

In case this addition gets a thumbs up I will of course improve 
test coverage and any needed quality of implementation.

[1] https://github.com/dlang/dmd/pull/6703



More information about the Digitalmars-d mailing list