JuliaLang / Compat.jl

Compatibility across Julia versions
Other
144 stars 117 forks source link

Document what got dropped in 4.0 #775

Closed LilithHafner closed 2 years ago

LilithHafner commented 2 years ago

The readme states "don't forget to also declare compatibility with v4 with Compat = 3.x, 4 (unless you use one the very few things that got removed between Compat v3 and v4, which you most probably don't)."

I don't know what got removed, but it should be listed there so package maintainers can more confidently extend their compat to include Compat v4. I don't think dropping Julia 1.0 support counts as a breaking change (source, thanks ericphanson for the link).

martinholters commented 2 years ago

Personally, I'd be pragmatic and just try with Compat v4 to see whether it works. I wouldn't be against documenting what was dropped, though, if someone wants to do it. If I remember correctly, everything that was removed entirely had previously been deprecated in v3 and a few deprecations have been put into place, so https://github.com/JuliaLang/Compat.jl/commit/d91b01aebf92ff6aacbef08dad54b7812ed4e16a#diff-0c3a3096ea8aa5548f7facdd7eaa649293a64f785376cca25e23f14d6af4301d should give a complete picture.

LilithHafner commented 2 years ago

How do you feel about adding this header to the release notes here https://github.com/JuliaLang/Compat.jl/releases/tag/v4.0.0?

Instructions for supporting Compat 4.x

Change Compat = 3.x to Compat = 3.x, 4 in your Project.toml file, and see if everything still works. In most cases, this is all that is needed. Please do not remove support for 3.x unless you need a feature that is not present in 3.x, as it will make your package incompatible with packages that do not support 4.x. Note that adding support for Compat 4.x does not drop compatibility with Julia 1.0.

For a complete list of breaking changes in 4.0.0 and how to fix them, see below:

Removed aliases

Many deprecated aliases have been removed.

Replace Compat.x with Base.x for the following symbols:

invokelatest
MathConstants
Fix2
Sys
IteratorSize
IteratorEltype
notnothing
typename

Replace Compat.x with LinearAlgebra.x for the following symbols (you will also need to add import LinearAlgebra if you don't already have it):

tr
opnorm
norm
dot
qr
rmul!

Other depricated bindings that were removed include Compat.(⋅) which should be replaced with LinearAlgebra.dot Compat.AbstractDateTime which should be replaced with Dates.AbstractDateTime Compat.isabstract which should be replaced with isabstracttype

Stdlibs

If you used Compat.Stdlib you should now import Stdlib and then use Stdlib. This change is the primary reason for releasing 4.0.0, as it allows folks to depend on Compat without bringing in every standard library.

Other functions

Compat.macros_have_sourceloc was previously defined as true Compat.enable_debug(x::Bool) was previously defined as the identity function (with no side effects). You should be able to safely remove all occurrences of either of these functions from your code.

Compat.parameter_upper_bound got removed in Compat v4.0. If you still need it, you can inline it as

Base.@pure function parameter_upper_bound(t::UnionAll, idx)
    return Base.rewrap_unionall((Base.unwrap_unionall(t)::DataType).parameters[idx], t)
end

or rewrite your code to use static parameters in dispatch.

martinholters commented 2 years ago

Good idea, done.