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

**URL:** <https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [June 12, 2017, 4:21pm UTC](https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229 "2017-06-12T16:21:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jackels](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@Jackels](https://discourse.julialang.org/u/Jackels)\
**Post date:** [June 12, 2017, 4:21pm UTC](https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229/1 "2017-06-12T16:21:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adamslc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adamslc/32/3452_2.png) [@adamslc](https://discourse.julialang.org/u/adamslc)\
**Post date:** [June 12, 2017, 4:24pm UTC](https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229/2 "2017-06-12T16:24:11Z")

</div>

You need to import `log`, so something like this:

```julia
module MyModule
import Base: log

function log(str::AbstractString)
...
end

end

```

---

<div class="post-metadata">

**Author:** ![Jackels](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@Jackels](https://discourse.julialang.org/u/Jackels)\
**Post date:** [June 12, 2017, 4:26pm UTC](https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229/3 "2017-06-12T16:26:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 12, 2017, 4:29pm UTC](https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229/4 "2017-06-12T16:29:36Z")

</div>

> [@Jackels](#):
>
> Thanks! Any reason as to why I have to import log first?

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

---

<div class="post-metadata">

**Author:** ![Jackels](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@Jackels](https://discourse.julialang.org/u/Jackels)\
**Post date:** [June 12, 2017, 4:35pm UTC](https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229/5 "2017-06-12T16:35:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [June 12, 2017, 4:40pm UTC](https://discourse.julialang.org/t/how-to-export-functions-with-same-name-but-different-signature-that-are-in-base/4229/6 "2017-06-12T16:40:42Z")

</div>

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