String interpolation, after a healthy debate on discord
ManKey
mensikovk817 at gmail.com
Sat Dec 11 00:36:12 UTC 2021
On Thursday, 9 December 2021 at 21:06:11 UTC, WebFreak001 wrote:
> We had an argument on the discord about the
IMHO, this can be done through string mixins. But mixins have a
large syntax (This is very strange for a language in which
closures can be written as `{code}`.). If it was possible to
write instead of `mixin(i!"2 + 3 = ${2 + 3}")` something like
this `#i!"2 + 3 = ${2 + 3}"`, then this DIP would not be needed.
Then it would be possible not only to do string interpolation,
for example:
```d
JSON j = #jsonlit!q{
"any" ~ "d_expr": 5 + 6,
"key": data.map!(func).array,
};
```
More information about the Digitalmars-d
mailing list