Midpoints deprecation

question

#1

Base.midpoints was deprecated for v0.6, and ostensibly moved to StatsBase, which appears to export the symbol but not define it. So I get Base.midpoints, with warnings. What should I do to get rid of the deprecation warnings?

Is it that midpoints code will be moved to StatsBase from Base for v0.7, and this was a shortcut as a prelude to that?

julia> using StatsBase: midpoints

julia> midpoints(1:2:10)
WARNING: midpoints(r::Range) is deprecated, use r[1:length(r) - 1] + 0.5 * step(r) instead.
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
 [2] midpoints(::StepRange{Int64,Int64}) at ./deprecated.jl:57
 [3] eval(::Module, ::Any) at ./boot.jl:235
 [4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
 [5] macro expansion at /home/tamas/.julia/v0.6/Revise/src/Revise.jl:775 [inlined]
 [6] (::Revise.##17#18{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
2.0:2.0:8.0

julia> VERSION
v"0.6.2"

#2

I have not problem in 0.6.1

julia> midpoints(1:2:10)
WARNING: midpoints(r::Range) is deprecated, use r[1:length(r) - 1] + 0.5 * step(r) instead.
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
 [2] midpoints(::StepRange{Int64,Int64}) at ./deprecated.jl:57
 [3] eval(::Module, ::Any) at ./boot.jl:235
 [4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
 [5] macro expansion at ./REPL.jl:97 [inlined]
 [6] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
2.0:2.0:8.0

julia> using StatsBase: midpoints

julia> midpoints(1:2:10)
2.0:2.0:8.0

julia> VERSION
v"0.6.1"

But 0.7.0 is problematic:

julia> using StatsBase
[ Warning: Replacing module `Compat`                                                                                                                   @ Base loading.jl:350
[ Warning: Replacing module `DataStructures`                                                                                                           @ Base loading.jl:350

julia> :midpoints in names(StatsBase)
true

julia> StatsBase.midpoints(1:2:10)
ERROR: UndefVarError: midpoints not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:14
 [2] top-level scope

julia> VERSION
v"0.7.0-DEV.3373"

#3

I think that deprecations only show up once, so by calling it in Base you don’t get it after.


#4

You are right!

Now it seems interesting to me that StatsBase.midpoints is “replaced” with Base.midpoints:

julia> import  StatsBase

julia> @which StatsBase.midpoints(1:2:10)
midpoints(r::Range) in Base at deprecated.jl:56