DIP 1027---String Interpolation---Community Review Round 1

mipri mipri at minimaltype.com
Fri Dec 13 01:19:32 UTC 2019

On Friday, 13 December 2019 at 00:06:15 UTC, Adam D. Ruppe wrote:
> But it can get pretty interesting to look beyond function 
> calls. What about some kind of object literal?
> int a;
> string b;
> JSONValue j = json!iq{
>      a: #{a},
>      b: #{b}
> };

This doesn't work though:

   auto n = 4;
   [1,2,3].map!(format("a + %s", n)).each!writeln;
   // Error: variable n cannot be read at compile time

It doesn't even work to pass that format() to

   void ignore(string s)() { }

So I imagine i"" strings won't be useful in static arguments
except with static parameters.

More information about the Digitalmars-d mailing list