String Interpolation

jmh530 john.michael.hall at gmail.com
Fri Oct 27 15:36:20 UTC 2023


On Friday, 27 October 2023 at 14:16:01 UTC, Arafel wrote:
> On 27/10/23 14:49, jmh530 wrote:
>> I tried to think of when I just want a string after doing 
>> interpolation (as opposed to writing immediately somehow) and 
>> struggled a bit.
>
> I, on the other hand, do it constantly, especially when dealing 
> with external libraries / systems.
>
> Here is the first short and almost self-contained real-world 
> example that I found having a quick look at my code. Just see 
> how I construct and use `mailOrder` and `input`:
>
> [snip]

Honestly, I don't see that much of an issue with `.text`, but I 
suppose I get that it would be an issue for new users. 
Personally, I would just do the template version of what you 
discussed and rejected, but if that's not for you, that's fine 
too.

One thing I considered was if you just are able to assign to a 
string if you don't use any formatting, but I think that leads to 
confusion as well. Either you go all the way or you don't.


More information about the Digitalmars-d mailing list