DIP 1027--String Interpolation--Final Review Discussion Thread

Sebastiaan Koppe mail at skoppe.eu
Mon Feb 3 19:10:54 UTC 2020


On Monday, 3 February 2020 at 14:52:24 UTC, Adam D. Ruppe wrote:
> On Monday, 3 February 2020 at 14:37:22 UTC, Steven 
> Schveighoffer wrote:
>> I'd do it a little different, so we don't throw away the work 
>> the compiler already did:
>>
>> i"$apples and ${%d}bananas"
>>
>> =>
>>
>> (__d_format_literal!(Format.init, " and ", Format("%d")), 
>> apples, bananas)
>
> Yes, that would be excellent. If you make a motion to amend the 
> DIP, I'll withdraw my motion and second yours. Let's form a 
> coalition and get Walter onboard!

This looks really good. When using it as a DSL, there is no need 
to parse the '%s' the compiler just inserted.

Plus it is a bit more structured than the bare tuple there was 
before.

Best of both worlds, I would say.


More information about the Digitalmars-d mailing list