# @deprecate of call overload

**URL:** <https://discourse.julialang.org/t/deprecate-of-call-overload/36578>\
**Category:** General Usage\
**Created:** [March 27, 2020, 1:15am UTC](https://discourse.julialang.org/t/deprecate-of-call-overload/36578 "2020-03-27T01:15:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abulak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abulak/32/28314_2.png) [@abulak](https://discourse.julialang.org/u/abulak)\
**Post date:** [March 27, 2020, 1:15am UTC](https://discourse.julialang.org/t/deprecate-of-call-overload/36578/1 "2020-03-27T01:15:31Z")

</div>

```julia
module MyModule
    struct AAA end
    Base.one(A::AAA) = 1
    @deprecate zero(A::AAA) one(A::AAA)
end
MyModule.zero(MyModule.AAA())
┌ Warning: `zero(A::AAA)` is deprecated, use `one(A::AAA)` instead.
│ caller = top-level scope at REPL[7]:1
└ @ Core REPL[7]:1
1

```

```julia
module MyModule
    struct AAA end
    Base.one(A::AAA) = 1
    @deprecate (A::AAA)() one(A::AAA)
end
ERROR: LoadError: invalid usage of @deprecate
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] @deprecate(::LineNumberNode, ::Module, ::Any, ::Any, ::Bool) at ./deprecated.jl:57
 [3] @deprecate(::LineNumberNode, ::Module, ::Any, ::Any) at ./deprecated.jl:34
in expression starting at REPL[4]:4

```

Is this a bug or there is a `call` like function to deprecate instead of `(A::AAA)()`?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 27, 2020, 1:08pm UTC](https://discourse.julialang.org/t/deprecate-of-call-overload/36578/2 "2020-03-27T13:08:59Z")

</div>

I don’t know if the `@deprecate` macro works here, but you can always call `Base.depwarn` manually and achieve the same result:

```julia
julia> struct Foo
       end

julia> function (f::Foo)()
         Base.depwarn("(::Foo)() is deprecated", :foo_call_overload)
       end

julia> f = Foo()
Foo()

julia> f()
┌ Warning: (::Foo)() is deprecated
│ caller = ip:0x0
└ @ Core :-1

```
