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

Jab jab_293 at gmall.com
Sun Dec 15 17:26:57 UTC 2019


On Sunday, 15 December 2019 at 15:36:09 UTC, Guillaume Piolat 
wrote:
> On Sunday, 15 December 2019 at 09:30:45 UTC, Andre Pany wrote:
>>> string a = i"";
>>
>> This is for me the most important thing for string 
>> interpolation. A convenient string assignment.
>> If this is not convenient, it destroys the great feature of 
>> string interpolation.
>>
>> Walter, could you please make it happen?
>>
>> Kind regards
>> Andre
>
> Careful that if that happens, then it may be another feature 
> that can't be used without a runtime. As it stands, it is 
> usable with snprintf @nogc and that's pretty cool in my book.

There's no reason it can't be implicitly converted to a string. 
You could also easily write a @nogc wrapper if it outputs a 
tuple. It being usable with snprintf() means it outputs something 
that pretty much no other function uses. The only thing I know of 
that implements printf-style formatting is printf (or uses 
sprintf to implement it). All other use cases (the more common 
ones) this becomes a useless feature. Ultimately this DIP is 
trying to push a library specific detail (from another language) 
into D. That's just a bad idea.






More information about the Digitalmars-d mailing list