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

MoonlightSentinel moonlightsentinel at disroot.org
Thu Jan 30 13:58:13 UTC 2020

On Thursday, 30 January 2020 at 13:37:17 UTC, Seb wrote:
> Option A) with .expand
> printf(i"...".expand)
> Option B) with an overload in druntime
> int printf(InterpolatedString)(InterpolatedString str) {
>    return printf(str.expand)
> }
> printf(i"...")

Maybe even easier if dmd could handle a struct that decays into 
its members, e.g. an extended std.typecons.Tuple containing

alias expand this;

s.t. its members can be passed to printf & other functions 

(I recognize that `alias this` should be used carefully but this 
would avoid declaring overloads for every function that accepts 
some format string)

More information about the Digitalmars-d mailing list