struct tcg{F,T}
a::F
b::T
#= tcg(b::T,a::F=nothing) where {F, T} = begin
@show :tcg1
new{F,T}(a,b)
end =#
tcg(a::F,b::T) where {F, T} = begin
@show :tcg2
new{F,T}(a,b)
end
end
tcg(10)
yields the expected
ERROR: MethodError: no method matching tcg(::Int64)
Case 2:
struct tcg{F,T}
a::F
b::T
tcg(b::T,a::F=nothing) where {F, T} = begin
@show :tcg1
new{F,T}(a,b)
end
tcg(a::F,b::T) where {F, T} = begin
@show :tcg2
new{F,T}(a,b)
end
end
tcg(10)
To workaround the problem for the time being you could use
struct tcg{F,T}
a::F
b::T
tcg(b::T,a::Nothing) where {T} = begin
@show :tcg1
new{Nothing,T}(a,b)
end
tcg(a::F,b::T) where {F, T} = begin
@show :tcg2
new{F,T}(a,b)
end
end
tcg(10)