Ok. Then the manual page on modules should be rewritten. For example,
this line from the manual needs to be changed.

Import also differs from `using` in that functions must be imported
using `import` to be extended with new methods.

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.

I can make an effort to make changes to the manual, but I suspect that
it will be riddled with errors as I have only started with Julia.

Devendra

On 27 February 2015 at 15:58, Steven Sagaert <[email protected]> wrote:
> 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.



-- 
Cheers,
Devendra.

Reply via email to