DIP 1027---String Interpolation---Community Review Round 1
Jab
jab_293 at gmall.com
Thu Dec 26 16:35:43 UTC 2019
On Thursday, 26 December 2019 at 15:23:07 UTC, Mike Parker wrote:
> On Thursday, 26 December 2019 at 10:20:06 UTC, Patrick Schluter
> wrote:
>>
>>
>> If you read in the thread, Walter accepted the change to $
>> because od %% problem I noticed in the beginning of the thread.
>> I suppose he will amebd the document after that review cycle.
>
> He updated it last week:
>
> https://github.com/dlang/DIPs/commit/1f5959abe482b1f9094f6484a7d0a3ade77fc2fc
> No attempt is made to diagnose format specification errors,
> such as attempting to format
an integer as a floating point value. The meaning of the format
specifications is unknown
to the core language.
Why is this? If the language is going to embed the library
feature of printf into the language spec, then it should know
about and check formatting.
> string tool = "hammer";
> writefln(i"hammering %s with $tool", "nails");
> ```
> will produce:
> ```
> string tool = "hammer";
> writefln("hammering %s with %s", tool, "nails");
> ```
There's an obvious problem, even with the given example. This
will print:
hammering hammer with nails
Instead of the expected:
hammering nails with hammer
More information about the Digitalmars-d
mailing list