How to make an abstract type as a super type of composite types

Did you mean to reverse the “inequalities” here:

abstract type MyTypeB >: MyTypeA end
abstract type MyTypeC >: MyTypeA end

In other words, are you trying to define a struct and “later” (in another module that may not be used in all calls to the struct) make it a subtype of something else? I don’t think this is possible.

My conjecture is that you are doing this so that dispatch can be written based on the abstract type? Then you should not use a type hierarchy but traits. BinaryTraits.jl is a nice implementation, but there are others.

1 Like