Discussion Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Feb 2 14:20:31 UTC 2021


On 2/2/21 1:22 AM, Walter Bright wrote:
> On 1/31/2021 3:04 AM, claptrap wrote:
>> Why is "working with printf" so important?
> 
> It's a canary. printf has a very simple interface, and if string 
> interpolation doesn't work for simple cases, it is indicative of 
> complexity problems.

To me this sounds like the wrong litmus test.

printf: separate format from data

interpolation: mix format with data

It doesn't seem to me at all that the first thing I'd want to do with 
interpolated strings is to contort them into a use of printf.

> Along with, of course, everybody uses printf and printf-style functions 
> (dmd has many), and writef also uses a printf-style format.
> 
> I emphasize that #DIP1027 knows nothing about printf or its formats, 
> other than having the default format be `%s`. The default can, of 
> course, be overridden.
> 
> Again, DIP1027 KNOWS NOTHING ABOUT PRINTF OR ITS FORMATS.

This is good. We'd do good to keep printf out of the interpolation 
discussion.

CODE GENERATION IS WHERE IT'S AT.


More information about the Digitalmars-d mailing list