invenia / PowerSystemsUnits.jl

PowerSystems Units for Unitful
MIT License
5 stars 2 forks source link

Type piracy #4

Open oxinabox opened 5 years ago

oxinabox commented 5 years ago

The following methods are pirated from Base and Unitful.

round(x::AbstractArray{<:Quantity}, r::Int) 
round{T<:Quantity}(x::T, r::Int)
mean(x::AbstractArray{<:Quantity}, r::Int)
ustrip(x::Missings.Missing)
*{T<:Unitful.FreeUnits}(y::Missings.Missing, x::T)
*(x::Unitful.Units, y::Number)
*(x::Unitful.Units, y::Period)
*(x::Period, y::Unitful.Units)
convert(a::Unitful.Units, x::Period)

The piracy can be resolved by moving them into Unitful itself.

iamed2 commented 5 years ago

Although, these two should probably be removed and usage should change to broadcast instead:

mean(x::AbstractArray{<:Quantity}, r::Int)
round(x::AbstractArray{<:Quantity}, r::Int) 
oxinabox commented 5 years ago

round was removed from Unitful.jl on purpose. https://github.com/ajkeller34/Unitful.jl/issues/78

nicoleepp commented 5 years ago

Actually Unitful still has round methods for objects of type DimensionlessQuantity (https://github.com/ajkeller34/Unitful.jl/blob/master/src/quantities.jl#L279) but I agree that these methods should be deprecated and moved to Unitful or removed completely.