Can Julia have dispatch based on type aliases? Something rather similar to Scala 3’s opaque type aliases.
const MyTypeAlias = Float64 a::MyTypeAlias = 78.0 # The compiler should implicitly convert this from Float64 to MyTypeAlias some_func(a::Float64) = :foo some_func(a::MyTypeAlias) = :bar other_func(a::Float64) = :hi @assert some_func(78.0) == :foo @assert some_func(a) == :bar @assert other_func(a) == :hi # MyTypeAlias should be a subtype of Float64
This is rather similar to concrete single inheritance, which I have heard will cause problems for the compiler; But in this case, as the types are the same and we are just changing the dispatch, this should be possible?
PS: I have used
Float64 just as an example, please don’t suggest specific workarounds for numeric types.