String Interpolation
Patrick Schluter
Patrick.Schluter at bbox.fr
Sat Oct 21 18:14:55 UTC 2023
On Saturday, 21 October 2023 at 12:38:52 UTC, Commander Zot wrote:
> can we please just have ```i"whatever ${var}"``` to return a
> fully interpolated string, not a tuple, not a template or
> anything.
> because the common use case is ```auto s = i"whatever
> ${var}";```,
> so maybe just lower it into ```format("whatever %s", var)```.
>
> Then also introduce ```t"whatever ${var}"``` for a
> tuple/template returned object as a completely seperate
> proposal and you discuss whatever proposal is better for it
> YADIP or 1037 or whatever.
>
> this way it's also a lot simpler to understand what is
> happening for the users.
Interpolated strings, even if they look like it, are NOT strings.
They are a obfuscated or better said, conveniently laid out
source code.
They contain inside of them, between the {} program code even if
it is just a variable name. Strings are strictly just data.
Interpolated string is a mix of CODE and data.
By the very nature of what interpolated strings are it is not
possible to treat them as strings.
More information about the Digitalmars-d
mailing list