Better string mixins

rikki cattermole rikki at cattermole.co.nz
Fri Dec 28 12:34:27 UTC 2018


On 29/12/2018 1:29 AM, SashaGreat wrote:
> 
> It would be nice if it were like C#:
> 
> mixin("x = {0}", x);
> 
> More arguments:
> 
> mixin("x = {0}; y = {1}", x, y);
> 
> S.

No need.

import std.stdio;
import std.format;

void main() {
     int x;
     mixin("x = %d;".format(8));
     writeln(x);
}

Its hard to argue for syntax sugar when there is reasonable library 
code. Going to need to make a clear case argument for why this isn't 
acceptable. Otherwise a DIP for it would be rejected.


More information about the Digitalmars-d mailing list