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

Walter Bright newshound2 at digitalmars.com
Sun Dec 15 01:44:18 UTC 2019


On 12/14/2019 6:23 AM, Adam D. Ruppe wrote:
> On Saturday, 14 December 2019 at 09:10:47 UTC, Walter Bright wrote:
>> I find your proposal a little confusing. By turning the string into an object, 
>> it doesn't work with printf?
> 
> Right, not directly. But then it is trivial to add a member of the object that 
> transforms it into a tuple suitable for printf.
> 
> So the end user's code now looks like: `printf(i"foo %bar".asFormatTuple);`

I was afraid that would be it. The extra syntax kills it, along with the extra 
import required, along with not working with #betterC.

You can still #thagomize it, or turn it into an object, etc., with:

     Object thagomize(string, ...);
     ...
     thagomize(i"foo%bar");

It's just not the default.



More information about the Digitalmars-d mailing list