Just another example of missing string interpolation

mw mw at g.c
Sat Oct 14 15:53:20 UTC 2023


On Saturday, 14 October 2023 at 14:47:26 UTC, Andrey Zherikov 
wrote:
> On Saturday, 14 October 2023 at 06:25:15 UTC, Imperatorn wrote:
>> On Friday, 13 October 2023 at 18:24:08 UTC, Adam D Ruppe wrote:
>>> On Friday, 13 October 2023 at 17:31:29 UTC, bachmeier wrote:
>>>> I don't know, but I also don't know why I would want to, 
>>>> because DIP 1027 was not accepted.
>>>
>>> dip 1027 was utter trash, but there's future good dips that 
>>> would easily solve these things. pity D's leadership is so 
>>> clueless and obstinate.
>>
>> We just want to be able to do
>>
>> string s = "Hello {name}, you are {age} years old and have 
>> {money - 42} dollars in the bank";
>>
>> Is it too much to ask? 😭
>
> Why does not this work for you?
> ```d
> string s = text("Hello ",name,", you are ",age," years old and 
> have ",money - 42," dollars in the bank");
> ```

Too many unnecessary quotes and commas, tedious to write and 
read. And for debug purpose I also want to print the variable 
names ...

string interpolation is nothing fancy, but just syntax sugar to 
make the life easier.
People have been asking it for years, but still not available.


So, why not just do it?






More information about the Digitalmars-d mailing list