Discussion Thread: DIP 1036--Formatted String Tuple Literals--Community Review Round 1

Avrina avrina12309412342 at gmail.com
Tue Sep 8 12:10:29 UTC 2020


What's the purpose of toFormatString with a default spec? Why 
would you ever want to have a default??? That's just some hacky 
workaround from the previous DIP to circumvent some arbitrary 
rule. Why wouldn't you have some sort of type map instead that 
maps a format string to a type? All of that information is 
available.

The way 'hasAllSpec' seems to be intended to use just seems 
terrible. What happened to having an overload for printf() to 
handle the case of an interpolated string. Is that overload not 
happening? Implicitly converting to char* on a condition like 
'hasAllSpec' is just asking for trouble. This special case isn't 
required, it will only introduce bugs; just add an overload to 
printf. It also requires the user to specify all the formatting 
themselves when all that information is already there for it to 
know what formatting specifier to use. That wouldn't fly in a 
intrrolated string library implementation and it definitely 
shouldn't fly as a language feature.

The 'toFormatStringImpl' and friends implementations should just 
be removed. Its simple enough that anyone can implement it, 
not.like there is a performance benefit anyways as it is just 
going to be using CTFE, like a library implementation. It is also 
too specific, something like an sql query would just put a number 
depending on the order of the parameters. So in that case it isnt 
really a specifier for the argument some much as which argument 
should go where. I can only imagine how confusing and error prone 
that is going to be, especially since you have to specify every 
single argument if you dont implement your own wrapper or 
overload to fix this.





More information about the Digitalmars-d mailing list