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

Patrick Schluter Patrick.Schluter at bbox.fr
Mon Dec 16 22:33:57 UTC 2019

On Monday, 16 December 2019 at 22:12:37 UTC, mipri wrote:
> On Monday, 16 December 2019 at 22:02:05 UTC, Steven 
> Schveighoffer wrote:
>> Might I suggest we come up with a new name for this technique?
>> I see there is going to be a lot of users who want true string
>> interpolation, e.g.:
>> string str = i"My name is $name";
>> and be very confused that D string interpolation isn't like
>> https://en.wikipedia.org/wiki/String_interpolation
>> Maybe something like "format tuple expansion" or "formatted
>> interpolation"?
>> -Steve
> Programming language terminology is so random already that
> this isn't going to help. Perl has 'hashes' and Python has
> 'dicts' and other languages have 'maps', but when I read about
> AAs in D I just said "oh, hash tables" and mentally translated
> all references from then on. People are going to do exactly the
> same thing to "tuple expansion strings" and still complain that
> "string interpolation in D" doesn't work as they expect.
> But if it's called "tuple expansion strings", they'll *also*
> complain about the weird name.
> There might be some satisfaction in saying "you *should* have
> expected something different because of the different name",
> or in giving an explanation of the different name, but this
> would all be a distraction from explaining why D's string
> interpolation is different.
The issue with user expectations should not be holding up on what 
to define for D. I checked today what other languages do and at 
least for kotlin. C#, scala, swift and 2 other there is nothing 
consistent of what interpolated strings are. In rust it is even 
more than a joke as they call interpolated normal C style format 

So imo we should try to implement what fits the best the language 
and CT tuples is as D-ish as it gets.

More information about the Digitalmars-d mailing list