String Interpolation
Arafel
er.krali at gmail.com
Fri Oct 27 09:47:15 UTC 2023
On 27/10/23 11:30, IGotD- wrote:
> I've not been following the string interpolation debate because I'm not
> a big user of string interpolation but this made me wake up. Are you
> seriously proposing a design that cannot convert a string interpolated
> string into a regular string?
Yes, these are the current proposals.
Or at least not directly. You'll need to call a function for that.
So this will work:
```d
writeln(i"Hello, ${name}");
```
But this won't:
```d
string greeting = i"Hello, ${name}";
```
and you will need to do:
```d
string greeting = i"Hello, ${name}".text;
```
Walter's proposal is essentially the same in that regard, only using
`writefln` and `format` instead of `write` and `text`.
Good luck explaining these subtleties to new / casual users.
More information about the Digitalmars-d
mailing list