Is there a quick fix for a package introducing type piracy? Currently, importing Images
clobbers Distances
because it imports ImageDistances
that overloads evaluate
(see avoid type piracy? · Issue #28 · JuliaImages/ImageDistances.jl · GitHub). Is there a temporary fix as a user that I can do till this is figured out?
julia> using Distances
julia> evaluate(WeightedEuclidean([1,1,1000]), [1,2,3], [1,2,4])
31.622776601683793
julia> sqrt(1000)
31.622776601683793
julia> using Images
julia> evaluate(WeightedEuclidean([1,1,1000]), [1,2,3], [1,2,4])
ERROR: MethodError: Distances.result_type(::WeightedEuclidean{Array{Int64,1}}, ::Array{Int64,1}, ::Array{Int64,1}) is ambiguous. Candidates:
result_type(dist::PreMetric, ::AbstractArray{#s19,N} where N where #s19<:Union{Colorant{T1,N} where N, AbstractArray{#s12,N} where #s12<:Union{Colorant{T1,N} where N, T1} where N, T1}, ::AbstractArray{#s17,N} where N where #s17<:Union{Colorant{T2,N} where N, AbstractArray{#s12,N} where #s12<:Union{Colorant{T2,N} where N, T2} where N, T2}) where {T1<:Number, T2<:Number} in ImageDistances at /home/tamas/.julia/packages/ImageDistances/okX3M/src/generic.jl:83
result_type(dist::Union{WeightedCityblock{W}, WeightedEuclidean{W}, WeightedHamming{W}, WeightedSqEuclidean{W}, WeightedMinkowski{W,T} where T<:Real} where W, ::AbstractArray{T1,N} where N, ::AbstractArray{T2,N} where N) where {T1, T2} in Distances at /home/tamas/.julia/packages/Distances/HOWRG/src/wmetrics.jl:46
Possible fix, define
result_type(::Union{WeightedCityblock{W}, WeightedEuclidean{W}, WeightedHamming{W}, WeightedSqEuclidean{W}, WeightedMinkowski{W,T} where T<:Real} where W, ::AbstractArray{T1<:(Union{Colorant{T1,N} where N, AbstractArray{#s12,N} where #s12<:Union{Colorant{T1,N} where N, T1} where N, T1} where T1<:Number),N} where N, ::AbstractArray{T2<:(Union{Colorant{T2,N} where N, AbstractArray{#s12,N} where #s12<:Union{Colorant{T2,N} where N, T2} where N, T2} where T2<:Number),N} where N)
Stacktrace:
[1] evaluate(::WeightedEuclidean{Array{Int64,1}}, ::Array{Int64,1}, ::Array{Int64,1}) at /home/tamas/.julia/packages/Distances/HOWRG/src/wmetrics.jl:0
[2] top-level scope at none:0