# Overloading base operator from module

**URL:** <https://discourse.julialang.org/t/overloading-base-operator-from-module/621>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 28, 2016, 6:36pm UTC](https://discourse.julialang.org/t/overloading-base-operator-from-module/621 "2016-11-28T18:36:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [November 28, 2016, 7:15pm UTC](https://discourse.julialang.org/t/overloading-base-operator-from-module/621/3 "2016-11-28T19:15:29Z")

</div>

tldr: add `import Base: *` inside your module.

Long version:  
Julia already has a function called `*` (which does various kinds of multiplication) defined in `Base`, (`Base` is the set of functions that Julia ships with).  
Calling `function *(...)` creates a new function called `*`. That doesn’t change or delete the function that Julia already has, but it does create an ambiguity: when you call `*(x, y)`, (or equivalently, `x * y`), do you want the function `*` in Base, or the one in your module? That’s what the error says: “uses of it in module Main must be qualified” means: "you will now have to say `Base.*(x, y)` or `JulHDG.*(x, y)` every time you do multiplication. You don’t want that.

But you don’t want to have to choose. You want the ‘correct’ version of `*` to be automatically chosen for a particular input type, right? That’s the whole promise of Julia. To do that, you need to tell Julia that you’re _not_ defining a brand-new function called `*`, but just adding some new behavior to the existing `*`. Importing `*` from Base tells Julia exactly that.

---

_[View the full topic](https://discourse.julialang.org/t/overloading-base-operator-from-module/621)._
