Make deprecated promote_eltype_op type stable#19937
Conversation
Sacha0
left a comment
There was a problem hiding this comment.
Given #19814 (comment), perhaps instead follow the typical deprecation approach, i.e. move the former logic of promote_eltype_op and broadcast_elwise_op into base/deprecated.jl and inject a depwarn into those methods? Best!
|
@Sacha0 Unfortunately, the typical deprecation logic requires a replacement, and the former logic of those functions to too complex to admit a short replacement. |
|
Perhaps a possible approach would be to deprecate this function without replacement, keeping the logic from before. |
Not following you? The typical approach to this sort of deprecation seems to be e.g. # Deprecate promote_eltype_op
_promote_eltype_op(::Any) = Any
_promote_eltype_op(op, A) = (@_inline_meta; _promote_op(op, eltype(A)))
_promote_eltype_op(op, A, B) = (@_inline_meta; _promote_op(op, eltype(A), eltype(B)))
_promote_eltype_op(op, A, B, C, D...) = (@_inline_meta; _promote_eltype_op(op, eltype(A), _promote_eltype_op(op, B, C, D...)))
@inline function promote_eltype_op(op, A, B, C, D...)
depwarn("promote_eltype_op deprecated etc etc...")
_promote_eltype_op(op, A, B, C, D...)
end |
|
Indeed, that is what I meant by my last comment. This is a deprecation without replacement. (Most deprecations seem to be done with replacement.) |
|
@Sacha0 I believe I will implement that, but what should be done about the deprecation message? Should we recommend |
Cheers, same page now.
Recommending |
|
I have some reservations about recommending a function prefixed with an underscore. Perhaps we should rename it to and recommend |
Likewise: I'm not certain whether encouraging |
|
I think a good compromise would be to point at #19669, i.e. promote_eltype_op is deprecated and should not be used in the future.
See https://github.com/JuliaLang/julia/issues/19669 for more information. |
Sounds good! :) |
278965f to
ec31934
Compare
|
@Sacha0, thank you for your comments and input. I have modified the PR as discussed. |
Sacha0
left a comment
There was a problem hiding this comment.
LGTM. Could also deprecate broadcast_elwise_op more gently (in case there are other uses outside base), but perhaps not worth the effort? Best!
|
A quick search turned up no uses of |
|
This LGTM too.
|
|
Appveyor failure seems to be a libgit2 problem. |
|
I don't think ensuring a deprecated function is inferable is worth the effort; but as it has been spent anyway, why not. |
|
(Added milestone so that merging these changes won't slip through the cracks. Best!) |
Were your work dependent on that deprecated function, I wager your position would be different 😉. Best! |
|
Like @martinholters said, AV fail seems unrelated. And we have a bunch of 👍 for this, so I am going to merge. |
The suggestion for a replacement for the deprecated
promote_eltype_opwas type-unstable, so this replaces it with a type-stable version. Nevertheless, there is very little reason for this function to be called at all. Arguably it may even better to suggest aBase._broadcast_eltypeas a replacement.cc @martinholters @Sacha0 @pabloferz
related #19814