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

mipri mipri at minimaltype.com
Sun Dec 15 17:50:56 UTC 2019


On Sunday, 15 December 2019 at 17:38:29 UTC, Adam D. Ruppe wrote:
> On Sunday, 15 December 2019 at 17:26:57 UTC, Jab wrote:
>> It being usable with snprintf() means it outputs something 
>> that pretty much no other function uses.
>
> D's writef uses it too, as well as std.format. Do do the vibe 
> logging functions.
>
> It is a common format.

Which brings this to mind:

   import std.stdio;

   void main() {
       int n, m;
       write("input: ");
       readf(i"$n - $m");
       writeln(n + m);
   }

As used:

   $ ./test
   input: 2 - 8
   10

When's the last time you saw string interpolation
that resulted in the variables getting set to new
values?


More information about the Digitalmars-d mailing list