# Deprecate method of extended function

**URL:** <https://discourse.julialang.org/t/deprecate-method-of-extended-function/21491>\
**Category:** General Usage\
**Tags:** deprecation\
**Created:** [March 5, 2019, 1:19pm UTC](https://discourse.julialang.org/t/deprecate-method-of-extended-function/21491 "2019-03-05T13:19:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [March 5, 2019, 1:19pm UTC](https://discourse.julialang.org/t/deprecate-method-of-extended-function/21491/1 "2019-03-05T13:19:24Z")

</div>

Say I have the following dummy module

```julia
module MyModule

struct MyType end

Base.length(m::MyType) = 5

export length

end

```

What I want to do is `@deprecate` the `length` function in favor of a different function, say `mylength`. The following works:

```julia
module MyModule

struct MyType end

mylength(m::MyType) = 6

import Base: length
@deprecate length(m::MyType) mylength(m)

export length, mylength

end

```

Note the explicit `import Base.length`. A simple  
`@deprecate Base.length(m::MyType) mylength(m)` doesn’t work.

Is it possible to avoid the explicit import statement somehow?

---

<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:** [March 5, 2019, 2:53pm UTC](https://discourse.julialang.org/t/deprecate-method-of-extended-function/21491/2 "2019-03-05T14:53:37Z")

</div>

I think this is a bug — `@deprecate` could be extended to handle this. Please open an issue if there isn’t an existing one.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [March 5, 2019, 2:59pm UTC](https://discourse.julialang.org/t/deprecate-method-of-extended-function/21491/3 "2019-03-05T14:59:56Z")

</div>

Turns out there is one: [`@deprecate` should support qualified names · Issue #30310 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/30310)
