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

mipri mipri at minimaltype.com
Fri Dec 13 09:06:07 UTC 2019


On Friday, 13 December 2019 at 08:54:08 UTC, Walter Bright wrote:
> On 12/11/2019 11:30 PM, mipri wrote:
>>    void takes_a_normal_string(string s) { }
>> 
>>    takes_a_normal_string(i"%one + %two = %(one + two).");
>
> I'm not sure what you expect that to do?

Complete example:

   import std.stdio;

   void takes_a_normal_string(string s) {
       writeln(s);
   }

   void main() {
       immutable one = 1, two = 2;
       takes_a_normal_string(i"%one + %two = %(one + two).");
   }

Output:

   1 + 2 = 3

But, this works with DIP 1027, so I think it's fine:

   import std.format;
   ...
   takes_a_normal_string(i"%one + %two = %(one + two).".format);



More information about the Digitalmars-d mailing list