The state of string interpolation

Mike Franklin slavo5150 at yahoo.com
Fri Dec 7 13:46:55 UTC 2018


On Thursday, 6 December 2018 at 11:03:23 UTC, Zoadian wrote:
> would it be possible to have some kind of eponymous mixin 
> templates in the language?
> I'd imagine it to look something like this:
>
> ````
> import std.stdio;
>
> mixin template interp(string S) {
>     mixin interp = S; //some fancy code to replace ${_var_} 
> with content of _var_
> }
>
> void main() {
>     int a = 5;
>     string b = interp!"hello ${a} world";
> }
> ```

Not sure if its the same thing you're thinking of, but please see 
this already filed enhancement request:  
https://issues.dlang.org/show_bug.cgi?id=18586

Mike


More information about the Digitalmars-d mailing list