Deprecate method of extended function

carstenbauer
Tue, 05 Mar 2019 13:19:23 +0000
General Usage

Say I have the following dummy module

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:

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?

3 posts - 2 participants