On 2015-09-22 22:18, Nick Sabalausky wrote:

=====================
String Interpolation:
=====================
https://github.com/Abscissa/scriptlike#string-interpolation

AFAICT, a string mixin is necessary to accomplish this in D, but
otherwise it works much like other languages:

--------------------------------------------
// Output: The number 21 doubled is 42!
int num = 21;
writeln(
     mixin(interp!"The number ${num} doubled is ${num * 2}!")
);
--------------------------------------------

The interpolated sections are handled via std.conv.text(), so they
accept any type.

Bikeshedding requested! I'm not 100% sold on the name "interp" for this
long-term. Suggestions welcome.

Different bikeshedding: I would prefer to make the curly braces optional if it only contains a symbol.

--
/Jacob Carlborg

Reply via email to