CanonicalTraits.jl icon indicating copy to clipboard operation
CanonicalTraits.jl copied to clipboard

API constraints for method arguments

Open cscherrer opened this issue 4 years ago • 5 comments

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?

cscherrer avatar Jan 19 '20 19:01 cscherrer