I don't know how to locally extend a Base operator and I couldn't find anything about that.
I can obviously redefine it in the global scope (REPL or module) doing :
import Base.-
-(x, y::Nothing) = nothing
-(x::Nothing, y) = nothing
But I would like to have this to stay private in my module and not exported automatically to the global scope, in order not to pollute it, and still be able to use extensions in some functions in the module.
I tried let ... end
blocks or even to redefine it inside my module's functions but it seems to prevent from importing Base properly.
I would like something like :
module MyModule
export my_visible_function
function -(x, y::SomeType)
# Base.- extension with x and ::SomeType
end
function my_visible_function()
# code using Base.- extension
end
end
Is there anyway to do that?
Thanks for help.