Description
Continuing the discussion from https://discourse.julialang.org/t/discussion-on-why-i-no-longer-recommend-julia-by-yuri-vishnevsky/81151/219?u=holylorenzo @rafaqz.
Yeah lets try and get as much as possible out of defining this list! Maybe to make it available for other uses, instead of calling check like that, you could call it on the object then call the implements trait:
implements(::Type{<:MyObject}) = my_interface(optional_thing_1=true, optional_thing_2=false)
then in tests do:
check(obj)
and in docs like this would generate the markdown list of implemented traits and sub-traits:
@implements MyObject
and then in Invariants.jl define check like:
check(obj) = check(implements(obj), obj))
etc.
One problem I see with implements
returning a list of invariants is that now other packages cannot extend the list of supported interfaces for a type. I think that specifically dispatching on an interface that should be checked would resolve that.