If you have previously an exported type MyDateTime
in a registered package:
struct MyDateTime
instant::Int64
end
Would be adding a type parameter be a breaking change under the semantic versioning?
struct MyDateTime{T}
instant::T
end
This type is returned to the users and a code like this, could break:
dt = function_returning_MyDateTime()
@assert typeof(dt) == MyDateTime
And should be replaced by:
@assert typeof(dt) <: MyDateTime
It can also have performance implication if the user has a structure like this which would become non-concrete (but not break as far as I know):
struct UserStruct
dt::MyDateTime
end
Do you see other problems that could occur for the users?
In the package CFTime.jl I implemented various types for the time coordinates. Recently I added the possibility to use time precision lower than milliseconds, variable time origin and variable types of the instant containing the duration since the time origin (all using different type parameters). The only change in the old test suite (at 97% coverage, but I cannot anticipate all possible code of the users) was that I needed to change calls similar to typeof(dt) == MyDateTime
. But I think that it is unlikely that the user makes such checks.
Another package NCDatasets.jl uses CFTime.jl and passes the CFTime.jl types to users in some rare cases (in most cases the CFTime types are converted automatically to the Julia’s Dates.DateTime
, except when a NetCDF file uses a fictitious calendar assuming all months 30 days long for example). Would the additional type parameter in CFTime.jl also be a breaking change for NCDatasets?