Discussion Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Feb 1 00:17:51 UTC 2021

On 1/31/21 11:11 AM, Steven Schveighoffer wrote:
> This is how I would do it:
> i"Hello, ${var.withFormat!"%45s"} world";
> (where withFormat provides a toString overload that works with idup). No 
> extra intermediate allocations necessary.

I wonder if we can define a nice convention by the use of past tense vs. 

format!"%45s"(val) -> format using this spec the following values

val.formatted!"%45s" -> value formatted with this spec

We have just a bit of that with sort/sorted.

Maybe flesh that up in phobos 2.0 :o).

More information about the Digitalmars-d mailing list