DIP 1027---String Interpolation---Format Assessment

Paolo Invernizzi paolo.invernizzi at gmail.com
Thu Feb 27 13:00:59 UTC 2020


On Thursday, 27 February 2020 at 09:30:30 UTC, Walter Bright 
wrote:
> On 2/27/2020 12:27 AM, Petar Kirov [ZombineDev] wrote:
>> I'm well aware that allocation is inevitable if we want this 
>> behavior. My argument is that this behavior is so ubiquitous 
>> that not following it would be surprising to much more people, 
>> than if D didn't follow C's Usual Arithmetic Conversions 
>> rules. For example, Rust not following those conversion rules 
>> is considered a good thing,
>
> Rust does not follow C syntax at all, so nobody will reasonably 
> expect it to have C semantics. D does follow it, it's a 
> feature, so people will have expectations.

As shown, string interpolation in other languages (not only 
'stript', as you wrote) has a so well established way of 
performing it that everybody will reasonably expect D to behave 
the same.

Said that, better having no string interpolation at all in D, if 
the introduced feature is not at least comparable with the 
solution that the others out there are using: no surprise 
behaviour, please!

> and there it is. But having it generate a GC allocated string 
> is not so easy to unwind, i.e. it'll be useless with printf and 
> generate unacceptable garbage with writefln. The extra string 
> will always make it slow. Essentially, it'll be crippled. 
> Making D behave like a scripting language will yield scripting 
> performance.

It seems that the other compiled languages doing it in that way 
have raised no concerns at all on the above matters





More information about the Digitalmars-d-announce mailing list