It's not a bug it's a fature ;)
I found this odd also when I was new to julia and complained about it. I 
wanted strict private visibillity like in C++/Java/C#,.... but the julia 
team does not want this. The only thing export does is that you can call 
the function without the module prefix.

On Friday, February 27, 2015 at 9:11:35 AM UTC+1, Devendra Ghate wrote:
>
> Hello, 
> Consider the following example from the julia manual page on `modules`. 
>
> ~~~ 
>  module MyModule 
>
>  export x, y 
>
>  x() = "x" 
>  y() = "y" 
>  p() = "p" 
>
>  end 
> ~~~ 
>
> Load the module by any method makes function `MyModule.p()` available 
> in the main workspace. 
>
> 1. `using MyModule` 
> 2. `using MyModule.x` 
> 3. `import MyModule` 
> 4. `import MyModule.x` 
>
> I would expect `p` (as a private function) to be not available for 
> execution outside module. Manual page also mentions that this should 
> be the case. 
>
> I am using Julia 0.3.3. May be I need to upgrade. 
>
> Cheers, 
> Devendra. 
>

Reply via email to