opMixin or mixin function templates with convenience operator?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Dec 12 18:35:03 UTC 2019

On Thursday, 12 December 2019 at 18:24:30 UTC, Paul Backus wrote:
> Personally, I prefer this rewriting approach to something like 
> opMixin because it doesn't require you to declare a struct as 
> boilerplate, and it works "out of the box" for both templates 
> and CTFE, as well as "naked" strings:
>     #foo!(args) => mixin(foo!args)
>     #foo(args)  => mixin(foo(args))
>     #someCode   => mixin(someCode)

It is too noisy for formatting. Also, too hard for newbies to 
use, they will misapply it and get weird errors.

You need a type check on the library type to ensure that it has 
been designed for mixin. (Mixin should not exist on the 
application level.)

More information about the Digitalmars-d mailing list