String Interpolation Compare - DIP1027 and YAIDIP
Steven Schveighoffer
schveiguy at gmail.com
Sat Oct 21 04:32:52 UTC 2023
On Saturday, 21 October 2023 at 03:59:22 UTC, Walter Bright wrote:
> On 10/20/2023 8:51 PM, Steven Schveighoffer wrote:
>> YAIDIP:
>>
>> ```d
>> i"axy: $a{03} $x{e} $y{20.10}"
>> ```
>
> You and I must be reading a different version of
> https://github.com/John-Colvin/YAIDIP
>
> May I quote:
That portion is a *possible* usage. Perhaps the original authors
of YAIDIP didn't realize that it's still worth pointing out that
it effectively can also be solved with format specifiers. I
personally find the C++ style of formatting not as appealing as
the writef style. That portion of the DIP lists it as a benefit,
but I'm with you on the terseness of format specifications. It
really should be more clearly identified as an option, and not an
integral part of the proposal.
But that's the whole thing, with a tuple-based solution, you have
options in the library. You *can* use the C++ style or you *can*
use formatting encoded in the string literal. Both are available
depending on what you, the library author, would prefer.
And of course, YAIDIP (and 1036) has the benefit that runtime
parsing of the string-based format specifiers is not necessary,
whereas it is in 1027.
-Steve
More information about the Digitalmars-d
mailing list