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

Adam D. Ruppe destructionator at gmail.com
Thu Dec 12 13:36:38 UTC 2019


On Thursday, 12 December 2019 at 07:30:19 UTC, mipri wrote:
> A DIP that adds an innovative feature

This could be an innovative feature.

I see very little value in traditional string interpolation and 
I'd vote no on that. But these tuple ones are interesting and can 
do things unique to D... if we do it right.

> In code, this must all work:
>
>   auto s1 = i"I ate %apples and %{d}bananas.";

If that works, you've lost my support.

Note that with my proposal

string s1 = i"I ate %apples and %{d}bananas.";

could work though. auto and string are different - with string it 
can trigger `alias this`.

but if it is just plain string given from the compiler, we've 
gained nothing of interest. Even javascript's interpolation has 
more metaprogramming potential than that.

Do we want to lose to javascript?


BTW the JS one is actually quite interesting. It calls a 
user-defined function, passing the arguments - similar to the D 
tuple thing.


More information about the Digitalmars-d mailing list