Syntax for dispatching on subtypes

I don’t think we have anything like this with _, but if there are parameters you want to “ignore” you can write them as <:Any. Like
F{<:Any, <:TargetSupertype, <:Any, <:AnotherType}. Note that an inline <:X is a shorthand for something like _X with a where {_X <: X} at the end (although _X is something I made up and what the compiler uses will be sure to be unique), so those substitutions are equivalent to F{A, B, C, D} where {A,B<:TargetSupertype,C,D<:AnotherType}. Note also that where A<:Any is equivalent to where A, which is why I didn’t expand those fully.

1 Like