CanonicalTraits.jl
CanonicalTraits.jl copied to clipboard
API constraints for method arguments
Hi Taine,
I'd like to better understand the limitations of this approach, and any workarounds.
In the docs you say,
Due to the limitations of dynamic language, the type parameters occurred in trait signature should occur in the argument of each trait methods.
I had some bugs in an early attempt to use this, so your point on this is very helpful. But then in the README example you have,
@trait VecSpace{F, V} >: InnerProd{F, V} where
{F = V2F(V)} begin
dot :: [V, V] => F
end
Doesn't dot
violate this constraint? Is it the functional dependency that makes it still work? Do you have any general suggestions for using this package, especially wrt any interactions with abstract types?