another question on hidden mixin names

60rntogo 60rntogo at
Thu Sep 17 23:48:27 UTC 2020

On Thursday, 17 September 2020 at 22:07:54 UTC, Simen Kjærås 
> Usually, that would be:
> struct V {
>     int x;
>     mixin assign!"+" a;
>     mixin assign!"-" b;
>     alias opOpAssign = a.opOpAssign;
>     alias opOpAssign = b.opOpAssign;
> }
> However, I can't seem to get that working. It seems to be an 
> instance of this issue:

Yes, I tried that. It didn't work so I assumed that it must have 
been wrong. Is this a bug in the compiler or an issue in the 
language specification?

> btw, I'm somewhat surprised by your use of a template this 
> parameter 
> ( 
> Generally this will work, but you're probably better off with
>     ref auto opOpAssign(string op)(typeof(this) rhs) if (op == 
> op_)

I learned it from here:, 
could you elaborate on why this is not advisable?

More information about the Digitalmars-d-learn mailing list