FWIW, DuckDispatch.jl is my stab at structural typing and dispatch. Figuring out if one set of methods is a subset of another is actually not trivial because you might have something like
trait T1
getindex(::T1, ::Any)
end
trait T2
getindex(::T2, ::Int)
end
To decide if T2 is a subset of T1, we have to look at all the arguments of all the methods and check for subtyping. It’s pretty easy in this case, but gets very complicated if you add parameterized types and vararg and such. Additionally, I don’t even support marking a method signature with other traits. If you did that, things will get extremely complicated because now you’re recursively checking trait subsets ![]()