# Why the re-definition of some methods of f make the other methods un-exported?

**URL:** <https://discourse.julialang.org/t/why-the-re-definition-of-some-methods-of-f-make-the-other-methods-un-exported/4554>\
**Category:** General Usage\
**Created:** [June 29, 2017, 11:01pm UTC](https://discourse.julialang.org/t/why-the-re-definition-of-some-methods-of-f-make-the-other-methods-un-exported/4554 "2017-06-29T23:01:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrKrar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drkrar/32/3801_2.png) [@DrKrar](https://discourse.julialang.org/u/DrKrar)\
**Post date:** [June 29, 2017, 11:01pm UTC](https://discourse.julialang.org/t/why-the-re-definition-of-some-methods-of-f-make-the-other-methods-un-exported/4554/1 "2017-06-29T23:01:38Z")

</div>

is this a bug or a usual behavior.

> Version 0.7.0-DEV.772
> 
> julia\> module M  
> export f  
> f() = 1  
> f(x::Int)= x  
> f(x::Float64) = x  
> end  
> M
> 
> julia\> using M  
> julia\> f()=2  
> f (generic function with 1 method)  
> julia\> f()  
> 2
> 
> julia\> f(1)  
> ERROR: MethodError: no method matching f(::Int32)  
> Closest candidates are:  
> f() at REPL[2]:1

---

<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 29, 2017, 11:11pm UTC](https://discourse.julialang.org/t/why-the-re-definition-of-some-methods-of-f-make-the-other-methods-un-exported/4554/2 "2017-06-29T23:11:15Z")

</div>

When you define `f() = 2` outside of `M`, you are shadowing the definition in `M`. To get the behavior you expected (extending `f`) you need to `import M: f` before you defining a new method.

---

<div class="post-metadata">

**Author:** ![DrKrar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drkrar/32/3801_2.png) [@DrKrar](https://discourse.julialang.org/u/DrKrar)\
**Post date:** [June 29, 2017, 11:17pm UTC](https://discourse.julialang.org/t/why-the-re-definition-of-some-methods-of-f-make-the-other-methods-un-exported/4554/3 "2017-06-29T23:17:00Z")

</div>

> [@adamslc](#):
>
> import M: f

thanks,

[details from the Julia FAQ.](https://docs.julialang.org/en/latest//manual/faq/#What-is-the-difference-between-%22using%22-and-%22importall%22?-1)
