Here is an example:
mm(::Type{Tuple{X,Y}}) where X where Y = Type[X,Y]
julia> mm(Tuple{Int,T} where T<:Float64)
ERROR: UndefVarError: Y not defined
Stacktrace:
[1] mm(::Type{Tuple{Int64,T} where T<:Float64}) at ./none:1
[2] top-level scope at none:0
You can also try it with Base.unwrap_all, the result is same.
Thanks
You want
julia> (mm(::Type{Tuple{X,Y}}) where X where Y) = Type[X,Y]
mm (generic function with 1 method)
Nevermind, completely misread that.
what do you mean? that is no different from above.
It doesn’t work either.
Note the following:
julia> mm(::Type{Tuple{X,Y}}) where X where Y = :outer
mm (generic function with 3 methods)
julia> mm(::Type{Tuple{X,Y} where Y}) where X = :inner
mm (generic function with 3 methods)
julia> mm(::Type{Tuple{X,Y} where Y <: Float64}) where X = :specific
mm (generic function with 3 methods)
julia> mm(Tuple{Int,String})
:outer
julia> mm(Tuple{Int,T} where T<:Float64)
:specific
julia> mm(Tuple{Int,T} where T)
:inner
julia> mm(Tuple{Int,Float64})
:specific
I usually try not to do this kind of acrobatics and use some other, more transparent/readable mechanism, eg traits.