Discussion Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2
Steven Schveighoffer
schveiguy at gmail.com
Fri Jan 29 17:18:08 UTC 2021
On 1/29/21 3:02 AM, Walter Bright wrote:
> On 1/28/2021 8:47 PM, Adam D. Ruppe wrote:
>> D excels at these things.
>
> Ok, it's doable, but it's writing your own printf to do these
> manipulations.
It's doing what you want because it's possible. When someone says "yeah
but I can't do this", and I say "OK, here's a wrapper I wrote in 15
minutes that does what you want" and you say "But that means I need a
wrapper!", I don't really know where to go from here. You asked for
something that works with printf, I gave it to you. If you don't like
it, I don't know what to say, but it's trivially easy and can be inlined
to a direct call.
What if I complained that @safe feature is unusable because I had to
wrap the OS `read` as a @trusted function? Would that be a reasonable
argument? It requires a simple wrapper, write it and be done. Or don't
use @safe code.
In fact DIP1027 CANNOT make an overload for printf that's usable in D
code, and the existing printf can't be used with strings (ironically the
default specifier for DIP1027) without horrible syntax.
If you want to use printf without a wrapper, use printf as it was
intended. If you want to use printf with interpolation strings, use a
trivial wrapper.
-Steve
More information about the Digitalmars-d
mailing list