Description
Each optional component would (hidden in the macro) define the abstract type like:
abstract type SomeInterface_option <: SomeInterface end
We could make it nicer looking, but that's the direct translation from what we have now
First we can just inherit the main interface
@interface NewInterface <: BaseInterface NewObject conditions
But we could also inherit the optional component, which itself inherits the interface:
@interface NewInterface <: BaseInterface_opional_thing NewObject conditions
We would test the interface by iterating over supertype
until we hit AbstractInterface
then working backwards, so the basal interface is tested first. When @@implements
has multiple options, we would take the union
of the interfaces to test at each step to avoid duplicating any tests..
But... what we really want is a hack for multiple inheritance:
@interface NewInterface <: Union{BaseInterface_option,SomeInterface} NewType conditions
Where we would drop the real inheritance and instead write something like:
abstract type NewInterface{T} <: Interface{T} end
inherits(::Type{<:NewInterface}) = (BaseInterface_option, SomeInterface)
Then all tests and trait queries would recurse over inherits(T)
if a trait is false for T
.