Preparing for the New DIP Process

Danilo codedan at aol.com
Thu Jan 25 08:58:29 UTC 2024


On Thursday, 25 January 2024 at 07:56:50 UTC, Ogi wrote:
> String mixins are one the D’s killer features but the lack of 
> string interpolation make them look like a mess.

You can use `q{}`

```d
mixin(q{
     static foreach(p; __traits(parameters))
     {{
         enum pname = __traits(identifier, p);
         static if(__traits(hasMember, this, pname)) {
             __traits(getMember, this, pname) = p;
             pragma(msg, "found member: " ~ pname);
             pragma(msg, __traits(getAttributes, p));
             pragma(msg, __traits(getAttributes, typeof(pname)));
             //pragma(msg, p);
         }
     }}
});
```



More information about the Digitalmars-d-announce mailing list