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

rumbu rumbu at rumbu.ro
Wed Dec 11 11:35:05 UTC 2019


On Wednesday, 11 December 2019 at 11:00:12 UTC, MrSmith wrote:
> On Wednesday, 11 December 2019 at 10:48:56 UTC, Rumbu wrote:
>> So we cannot have variables named d, s, f, g, x and so on 
>> because they are standard format specifiers. What happens with 
>> custom format specifiers, any one letter variable cannot be 
>> interpolated?
>
> According to proposal you would wrap format specifiers into {}, 
> like i"%{d}bananas"

Nope, that means "use %d format specifier to print number of 
bananas". According to the DIP, this is invalid:

string what = "bread";
int d = 10;
writefln(i"making %what using %d ingredients");




More information about the Digitalmars-d mailing list