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

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Dec 11 11:40:44 UTC 2019


On Wednesday, 11 December 2019 at 11:21:08 UTC, Ola Fosheim 
Grøstad wrote:
> log(f"I have {dec(3,2)}{account.total} USD in my pocket")
>
> Becomes
> log("I have ", dec(3,2), account.total," USD in my pocket")

Actually, make that a tuple, but add proper tuples first. So that 
you can write

    log("Vector {vec_formatter(3,2)}{myvec} is ready.", 
log_channel)

and it becomes

    log (〈"Vector ", vec_formatter(3,2), myvec, " is ready."〉, 
log_channel )

Where «〈» and «〉» signifies the language-builtin tuple.



More information about the Digitalmars-d mailing list