I have an API for which the user defines methods for a function, to dispatch on user-defined types.
However, when the second argument is
nothing, I want this method to return
nothing without the user defining a method for the intersection. MWE:
abstract type ModelType end struct Bar <: ModelType end estimate(::Bar, ::Any) = 1 # I want do dispatch to the one below when possible # WITHOUT DEFINING estimate(::Bar, ::Void) estimate(::Any, ::Void) = nothing estimate(Bar(), nothing) # this is ambigous
Is this possible somehow?