DIP 1027---String Interpolation---Community Review Round 1
Seb
seb at wilzba.ch
Sun Dec 15 10:40:00 UTC 2019
On Sunday, 15 December 2019 at 01:44:18 UTC, Walter Bright wrote:
> 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,
I highly doubt that modern D applications use printf enough that
we should cater so much for it. Anyhow, I don't see why we
couldn't add an overload even for printf in druntime if the
.toString or .asFormatTuple is too much syntax.
> along with the extra import required,
It's a member of the struct. No import required.
> along with not working with #betterC.
Why? I don't see an argument for this. The interpolated struct is
templated, so the compiler would generate a new instance properly.
In fact, even a potential printf overload in druntime would still
work with #worseD as long as its templated.
More information about the Digitalmars-d
mailing list