Mixin overload sets
BLM768
blm768 at gmail.com
Fri Aug 16 08:57:32 PDT 2013
On Friday, 16 August 2013 at 07:48:52 UTC, QAston wrote:
>
> You can put those functions into HasOtherMixins by using alias.
> struct HasOtherMixins {
> ...
> alias someMixin!int.abc abc;
> alias someMixin!float.abc abc;
> alias someOtherMixin abc;
> }
Actually, that syntax only works for regular templates, not
mixins. Trying it with a mixin template gives an error. It's also
not very useful when mixing in several methods from the same
template.
However, the first solution I suggested could be expanded to
support that type of syntax:
struct HasMixins {
alias mixin someMixin!int.abc abc;
//etc.
}
I'm starting to lean toward the first option as the more
"correct" solution because it's more flexible and follows the
principle of least surprise. If it's decided that this would be
an acceptable addition to the language, I could try to cobble a
pull request together. I don't have any experience with the DMD
codebase, but it might be a good introductory project for me...
More information about the Digitalmars-d
mailing list