DIP 1027---String Interpolation---Community Review Round 1
Ernesto Castellotti
erny.castell at gmail.com
Thu Dec 12 06:47:28 UTC 2019
On Wednesday, 11 December 2019 at 20:46:03 UTC, Meta wrote:
> On Wednesday, 11 December 2019 at 20:28:21 UTC, Ola Fosheim
> Grøstad wrote:
>> [...]
>
> Yeah, I think if it comes down to adding a new language feature
> to the compiler, or changing how mixins behave in such a way
> that may be cause for security concerns, it's less costly to
> add the language feature.
>
> Really, though, all that's needed is to allow mixin templates
> to be mixed in without using the `mixin` keyword (I say "all",
> but that's quite a large language change):
>
> string interp(string s)()
> {
> ....
> }
>
> mixin template i(string s)
> {
> enum i = mixin(interp!s);
> }
>
> auto n = 2, m = 5;
> auto s = i!"The product of ${n} and ${m} is ${n * m}";
> writefln(s);
This would be really cool
More information about the Digitalmars-d
mailing list