Help? for deprecated and renamed items

It would be great if Julia help? would offer suggestions for deprecated and renamed items. Many times I have searched Google and found posted solutions that use functions or keywords that have since been deprecated or renamed. Two that I have encountered just recently are shift! and typealias. But there are many such examples. When you try to get help for shift! for example it only says:

Couldn't find shift!
Perhaps you meant sort! or circshift!
  No documentation found.

  Binding shift! does not exist.

It would be allot more helpful if it said Perhaps you meant popfirst!.

2 Likes

Julia does offer suggestions for deprecated functions. However, it only offers suggestions in the next major version, after which the function is dropped along with the suggestion.

If you have extremely old code (e.g. shift! is from Julia 0.6 or earlier), then the recommended upgrade procedure is to first upgrade to the next Julia release (e.g. Julia 0.7) and fix the deprecations, then upgrade to the next release etcetera.

For example, in Julia 0.7 you would get

julia> shift!([3,4,5], 1)
┌ Warning: `shift!` is deprecated, use `popfirst!` instead.
│   caller = top-level scope at none:0
└ @ Core none:0
ERROR: MethodError: no method matching popfirst!(::Array{Int64,1}, ::Int64)
Closest candidates are:
  popfirst!(::Array{T,1} where T) at array.jl:1125
Stacktrace:
 [1] shift!(::Array{Int64,1}, ::Vararg{Any,N} where N) at ./deprecated.jl:31
 [2] top-level scope at none:0

Fortunately, since the Julia 1.0 release, things have stabilized quite a bit and old code should normally continue to work with any Julia 1.x release.

PS. “Depreciated” is not the word you want here.

3 Likes