On Fri, Feb 27, 2015 at 5:50 AM, Devendra Ghate <[email protected]>
wrote:

> I only imported MyModule.x and was able to overload MyModule.y
> (exported function) as well as MyModule.p (not exported) functions.
>
> As far as I understand, there is no difference between an exported
> function and non exported function.
>

Are you sure you cleared the namespace between trying the four versions of
using/import MyModule/.x ?

If you only import MyModule.x, the method definitions for MyModule.p and
MyModule.y are never loaded. You can define a new y function but that is
not the same thing as overloading MyModule.y.

julia> import MyModule.x; x()
"x"

julia> x(a)=1
x (generic function with 2 methods)

julia> y() #MyModule.y not available
ERROR: UndefVarError: y not defined

julia> y()=2 #Define a new function
y (generic function with 1 method)

Jiahao Chen
Staff Research Scientist
MIT Computer Science and Artificial Intelligence Laboratory

Reply via email to