We can dispatch on the value types.
julia> f(A)
"Dispatch on argument A"
julia> f(B)
"Dispatch on argument B"
julia> f(C)
ERROR: DomainError with C:
Third-party code can extend MyType
with new type D
.
using ValueBasedDispatch
struct D <: MyType end
f(D) = "Dispatch on argument D"