It is not clear yet how trait dispatch should work. The current rules (which are mostly implemented) are:
a) find all matching traits
b) discriminate using subtraits, i.e. a subtrait will win over its supertrait
c) score all traits according to:
1 point for all single parameter traits,
2 points for all two parameter traits,
etc.
Now pick the highest scoring method.
d) if still ambiguous throw an error
a1) The base score is 1.0 + the maximum score of supertrait.
This is the dominant driver, assuming that each layer of trait inheritance adds a
significant notion of "specificity" to the match.
b2) each constraint in the trait definition, including the number of supertraits
(since it is just a constraint of istrait(SuperTr{X}) in disguise) would add
0.1 to the score.
c2) each number of parameters above 1 would add 0.01 to the score
It is not clear yet how trait dispatch should work. The current rules (which are mostly implemented) are:
Over in PR https://github.com/mauro3/Traits.jl/pull/4#issuecomment-69631916 @tonyhffong suggested some new rules:
We discussed the rules following https://github.com/mauro3/Traits.jl/pull/4#issuecomment-69631916 but let's continue this here.