On Thursday, 20 April 2017 at 21:34:44 UTC, Steven Schveighoffer
wrote:
Dmitry's solution is superior I think:
$"{a} times 3 is {a * 3}"
->
AliasSeq!(a, " times 3 is ", a * 3)
+1, this is more flexible.
Would work fine with writeln.
Yep, and std.conv.text. We might want a function that takes the
quoted AliasSeq expansion and writes it to an output range.
Would work fine with format.
No, std.format.format needs a format string as first argument,
supplying extra arguments will not work.
I like how this expansion *always* parses the string at
compile-time. The expansion could be passed whole as template
arguments if desired - I think this would allow text!(seq) which,
if passed only literal strings and runtime scalar types, can
return a fixed size static array, even though the scalar values
are read and formatted at runtime.