Just another example of missing string interpolation
Walter Bright
newshound2 at digitalmars.com
Wed Oct 18 03:57:52 UTC 2023
On 10/17/2023 7:39 PM, Adam D Ruppe wrote:
> On Wednesday, 18 October 2023 at 02:19:21 UTC, Walter Bright wrote:
>> I don't see how, from my reading of the proposal.
>
> The first example under the Description shows this exact situation and then goes
> on to explain how and why it works as expected.
The line in question:
```
writeln(__header, "I ate ", apples, " apples and ", bananas, " bananas totalling
", apples + bananas, " fruit.")
```
What does writeln() do with __header?
> Things work correctly with this proposal, you either get the expected results or
> a compiler error, as a natural consequence of the existing type system. Nothing
> needs to be spelled out about this as there are not any special cases.
Does that mean writeln() gets rewritten to handle __header? If so, ok, but the
YAIDIP doesn't say that.
Today, the only difference between writef() and write() is the former takes the
first argument as the format string. Is this a fatal error? I suppose you could
consider it as one, but that's an issue typical with variadic functions.
> Already did, over an hour ago.
Ok, I saw it after I posted that.
> It took about 30 seconds to specify. This isn't a
> big deal. (And btw, even if it didn't specify, the behavior is well-defined in
> the D Programming Language, and such things are already similar in other places,
> including other existing compiler hooks, see _d_cmain
> <http://dpldocs.info/this-week-in-d/Blog.Posted_2022_07_18.html>.
>
> But now the text does specify the fully qualified name anyway, so this is all moot.
I think we're misunderstanding each other. What I am asking about is how does
the user specify his own custom implementation of InterpolatedExpression?
More information about the Digitalmars-d
mailing list