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

Meta jared771 at gmail.com
Wed Dec 11 17:49:45 UTC 2019


On Wednesday, 11 December 2019 at 15:55:35 UTC, Patrick Schluter 
wrote:
> On Wednesday, 11 December 2019 at 12:50:34 UTC, Ernesto 
> Castellotti wrote:
>> On Wednesday, 11 December 2019 at 09:52:21 UTC, Mike Parker 
>> wrote:
>>> [...]
>>
>> From the dip it seems that it is only valid for writefln & co
>> So a code like:
>>    auto myText = i"I ate% apples"
>> would not be valid.
>
> It is allowed everywhere where a tuple expression is allowed
>
> auto myText = "I ate%s", apples
>
> doesn't make sense

It works already (un?)fortunately:

     auto test = AliasSeq!("The product of %s and %s is %s", 2, 5, 
10);
     writeln(test);  //Prints "The product of %s and %s is %s2510"
     writefln(test); //Print   "The product of 2 and 5 is 10"

This DIP is just taking that 1 extra small step to allow i"" 
strings to be lowered to tuple literals.


More information about the Digitalmars-d mailing list