Mixin templates are a pain at best, useless at worst for any non-trivial use case
Adam D. Ruppe
destructionator at gmail.com
Tue Jun 5 14:37:20 UTC 2018
On Tuesday, 5 June 2018 at 10:11:49 UTC, Ethan wrote:
> As soon as you have an overload of a function declared in the
> base object you're mixing in to, any other overload mixed in
> will not resolve correctly. Great.
Yes, it is great, since this lets you selectively override
behavior from a generic mixin template for a specific use. I like
this.
But we might be able to change the rule so, for functions, it
follows the overload rules with arguments instead of just going
by name. That would let you add functions... but that's
inconsistent with how D does child class inheritance too (you
need to alias in overloads there as well), for better or for
worse.
Perhaps adding something like `alias * = Base.*;` as a feature
would be good. I kinda hate that. But the idea there would be to
just add all of Base's things to the overload set. OK that
basically sucks especially when there's multiple bases. but it
would be fairly consistent.
More information about the Digitalmars-d
mailing list