Lazy formatting
Adam D. Ruppe
destructionator at gmail.com
Mon Feb 1 13:38:08 UTC 2021
On Monday, 1 February 2021 at 13:31:48 UTC, Kagamin wrote:
>> i"Hello, ${var.withFormat!"%45s"} world";
>
> I have a feeling recent DIPs are too detached from practice.
> [...]
> Who asked for one more way to do it? Almost all uses of
> interpolated strings are trivial ones i"I have ${n} apples".
In ruby and php and stuff you can do
"I have ${some_function()} apples".
That's what withFormat is, simply a function you're calling in
there which does a format.
The DIP itself just allows for
i"I have ${d_code_here} apples."
and d_code_here can be a simple variable or it can be a function
call or other fancy things. All the same feature.
More information about the Digitalmars-d
mailing list