4 ms·
But both fail short to Python/bash.. format strings where you can have "in place" reference to variable which IMHO is much more readable.
by renox 6y ago
But both fail short to Python/bash.. format strings where you can have "in place" reference to variable which IMHO is much more readable.
- ben-schaaf 6y agoI completely agree that string interpolation is often superior to a format string, but it's important to note that they are not equivalent. String interpolation is generally evaluated in-situ and has full access to the local scope. Format strings on the other hand can be passed around and manipulated (even at compile-time) and can only ever access the data they're formatted with. strftime and strptime are a good example of a format string usage that can't be replaced by string interpolation in python. D also has the capability of implementing string interpolation using mixins - though the resulting code isn't quite as neat.
- CyberDildonics 6y agoFormatting text output is not often a problem in the larger scope of a program, but having performance bottlenecks can be.
- WalterBright 6y agoI did write a proposal for "in place" reference (i.e. string interpolation) but could not reach consensus with the D community for it.