How to export functions with same name, but different signature, that are in Base



Now I know this is crazy, but i would like to define my own “log”-function to log messages. But when I do that and want to export it in my module I get

WARNING: both <MyModule> and Base export "log"; uses of it in module <SomeApp> must be qualified

Now writing MyModule.log is overly verbose and annoying to write. Is there a way to circumvent this?

My log-function btw. does not override any of the original log-functions because its signature is different.


You need to import log, so something like this:

module MyModule
import Base: log

function log(str::AbstractString)



Thanks! Any reason as to why I have to import log first?


So that way you extend the function, instead of shadowing it.


I do not understand. In general I am overloading the function, not shadowing it. Every other possible call should still be possible. Shadowing would mean that my function take precedence in a specific context over another function with the same name and inputs, but my inputs are different.


Overloading implies extending a function with a new method (different signature). In order to extend the original function, you have to import it first.