On Monday, 24 February 2020 at 09:51:16 UTC, Walter Bright wrote:
On 2/24/2020 12:43 AM, Robert M. Münch wrote:
I mean, people spend a lot of time thinking, making suggestions, etc. and the end result is: we now have nothing. Which, IMO is the worst result for all.

Not totally. I was unable to convince people that printf format validation was an orthogonal feature. So I went ahead and implemented that to show it had nothing to do with the proposal:

https://github.com/dlang/dmd/pull/10812

With the way that the DIP you wrote up, it really isn't orthogonal. How people *expect* string interpolation to work is like this:

   float a;
   int b;

   printf(i"$a $b"); // should just work


What your DIP did is this:


   float a;
   int b;

   // printf(i"$a $b"); becomes:
   printf("%s %s", a, b);

printf(i"${%d}a ${%f}b"); // need to do formatting on your own anyways

The only way you wouldn't want printf format validation for such a feature is if you are fine with buggy code. You literally still require the user to format the strings themselves, this is no different than simply using printf. And guess what:

It turned out kinda sweet, and found a huge number of latent bugs in our own code, proving we shoulda done that long ago :-) Bad printfs turned out to be much more common than I'd anticipated.

No shit.

Reply via email to