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

Robert burner Schadek rburners at gmail.com
Thu Dec 12 03:13:12 UTC 2019


On Wednesday, 11 December 2019 at 19:34:01 UTC, Patrick Schluter 
wrote:
>
> So you complexified your code because of a restriction of the 
> language.

Not at all, before I was trying to do to much.
With multiple format calls, I made the code boring
and easy to follow.
>
>>
>> Not being able to use * will stop me using this feature in 
>> many places.
>>
>>
>> The rationale about "missing arguments, wrong format 
>> specifier,... " Is a mute point IMO. format!"%d"(13.37) does
>
> MOOT not mute
>
>> the same thing already without any language change.
>> I thought the idea was not to introduce language changes if a 
>> library solution can do most of it already.
>> I find that the readability argument is highly subjective.
>
> It is but it is also true that from more than 4 parameters in a 
> format string it gets more and more noisy.

True, so you would split up the code, right!?
If both format styles don't work with more than x arguments,
why do I need to styles to not get the work done.
One is enough to shoot myself in the foot, isn't it.

>
>> The first part of the rationale is, IHO,
>> already pointing to the solution. Short strings are easy to 
>> manage.
>> So let's promote short strings in
>> combination with format!"%s" and
>> output ranges.
>>
>> How will this feature work at CT.
>> Format doesn't even work completely at CT.
>
> It's a problem with format and is perpendicular to this DIP, 
> i.e. if this DIP is adopted or not, it will not change anything 
> to the issues of format.

Why do we need it then?

>
>>
>> I know this goes a bit off topic,
>> but IMO this is a feature that is wanted,
>> because other languages have it.
>> And we want to say we have it too.
>
> May be sometimes it is good to look why certain features are 
> spreading like wildfire. C format specifiers were a regression 
> compared to what was available at that time (in Pascal or even 
> Cobol), but as C had so much other things to it, people tended 
> to accept the strange and ugly printf formatting, but it's 
> clear that i was universally loathed. That's why C++ tried this 
> worse shift syntax and other languages tried other solutions.
> It is not because we in the end managed to get used to the 
> outdated and dangerous printf format that it is good in the 
> first place.
> This DIP is simple enough that it is a good candidate imho to 
> be tried.
format!""() is not dangerous, if it is please show me why, I
use it all over the place.
I'm also not sure why it is outdated, format is very flexible
and powerful, i.e. array formatting is just awesome.





More information about the Digitalmars-d mailing list