Lazy formatting

Kagamin spam at here.lot
Mon Feb 1 13:31:48 UTC 2021


> This is how I would do it:
>
> i"Hello, ${var.withFormat!"%45s"} world";

I have a feeling recent DIPs are too detached from practice. If 
you read feature requests, people wanted interpolated strings in 
order to easily construct strings without tinkering. For ease of 
use. But the DIP's design rationale ended up being "because other 
languages have this". As design thus loses direction you end up 
designing an abstract silver bullet of interpolated strings 
without regard for practical needs. But we already have plenty of 
ways to tinker with string formatting. Who asked for one more way 
to do it? Almost all uses of interpolated strings are trivial 
ones i"I have ${n} apples".


More information about the Digitalmars-d mailing list