DIP 1027---String Interpolation---Community Review Round 1

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Dec 11 13:07:56 UTC 2019


On Wednesday, 11 December 2019 at 12:50:34 UTC, Ernesto 
Castellotti wrote:
> e if I'm wrong but from my point of view this "String 
> interpolation" is completely useless.
> I wish D had a string interpolation like Kotlin

The problem is making it work with something like a 
string-appender. If you don't have GC then you might want to 
estimate buffer size before allocating, so you need 2 passes.

* pass 1:

run over all items and caculate length

*allocate buffer

* pass 2:

call formatting-objects on each item and ask them to write 
themselves to a slice.

But a metaprogramming oriented language really should to support 
custom formatters well in interpolated strings.



More information about the Digitalmars-d mailing list