# Midpoints deprecation

**URL:** <https://discourse.julialang.org/t/midpoints-deprecation/8289>\
**Category:** General Usage\
**Tags:** question\
**Created:** [January 11, 2018, 1:19pm UTC](https://discourse.julialang.org/t/midpoints-deprecation/8289 "2018-01-11T13:19:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 11, 2018, 1:19pm UTC](https://discourse.julialang.org/t/midpoints-deprecation/8289/1 "2018-01-11T13:19:28Z")

</div>

`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
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"

```

---

<div class="post-metadata">

**Author:** ![Liso](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Liso](https://discourse.julialang.org/u/Liso)\
**Post date:** [January 11, 2018, 2:58pm UTC](https://discourse.julialang.org/t/midpoints-deprecation/8289/2 "2018-01-11T14:58:34Z")

</div>

I have not problem in 0.6.1

```julia
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
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"

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 11, 2018, 3:16pm UTC](https://discourse.julialang.org/t/midpoints-deprecation/8289/3 "2018-01-11T15:16:42Z")

</div>

> [@Liso](#):
>
> I have not problem in 0.6.1

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

---

<div class="post-metadata">

**Author:** ![Liso](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Liso](https://discourse.julialang.org/u/Liso)\
**Post date:** [January 11, 2018, 3:29pm UTC](https://discourse.julialang.org/t/midpoints-deprecation/8289/4 "2018-01-11T15:29:17Z")

</div>

You are right!

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

```julia
julia> import StatsBase

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

```
