[OT] C# can do all the interpolated strings now

WebFreak001 d.forum at webfreak.org
Wed Dec 8 15:39:44 UTC 2021


On Wednesday, 8 December 2021 at 13:28:33 UTC, Dennis wrote:
> On Wednesday, 8 December 2021 at 12:55:02 UTC, Adam D Ruppe 
> wrote:
>> there's another good document mostly written but waiting on 
>> john and andrei to take the next step.........
>
> https://github.com/John-Colvin/YAIDIP

ah yeah I couldn't remember where that one was, I only found the 
2 other DIPs while googling.

I like the overall idea but there is one thing that feels a 
little bad with that: If I have a function

```d
void foo(string header, string docs);
```

I can't just pass

```d
foo(i"$name's Website", i"Welcome on $name's Website");
```

because interpolated strings are not strings. I would need an 
extra .text call.

I think it would be easier on users if it was all one big struct 
like `InterpolatedString!(args here...)` - not being able to be 
multiple arguments at once

Otherwise if you had `void foo(T...)(T args)` you could no longer 
iterate over every argument individually, but need to keep track 
of state to know whether you are in an interpolated string. (and 
you don't know when it ends)


More information about the Digitalmars-d mailing list