The way to mark things private in Julia in my experience is simply not exporting them. They'll still be available on the Module object itself (e.g. MyModule.bar), but by not exporting them, you're signaling that they're private, the same way you do with an _ in Python.
On Tuesday, June 10, 2014 2:39:56 PM UTC-5, Davide Lasagna wrote: > > Thanks Patrick. > > Does this mean that there is no way to make things private? I thought > that only explicitly exported symbols where accessible. > > Anyway then, what is the common approach in Julia to mark things as > private? Python use single and double leading underscores, but haven't seen > too much _s in JUlia code. > > Davide > > On Monday, June 9, 2014 10:32:23 PM UTC+1, Patrick O'Leary wrote: >> >> Use the "using" keyword instead of the "import" keyword, in conjunction >> with your (correct) intuition about "export". >> >> module MyModule >> >> include("file.jl") >> export foo >> >> end >> >> ... >> >> using MyModule >> foo() >> MyModule.bar() >> >> On Monday, June 9, 2014 4:21:16 PM UTC-5, Davide Lasagna wrote: >>> >>> Hi all, >>> >>> I have a question about modules and I am probably missing something. >>> >>> Say that in file.jl I define functions foo and bar. I then create a >>> file MyModule.jl where I include file.jl as: >>> >>> module MyModule >>> >>> include("file.jl") >>> >>> end >>> >>> >>> At this point, in the REPL, doing import MyModule will give me access >>> to both foo and bar. Say, however, that I only want foo to be visible >>> from the outside, while I want bar to remain private, because it is >>> some accessory function used in foo. >>> >>> What is the preferred way to achieve this? I thought that after >>> include("file.jl") >>> I should have added an export foo to make it accessible to the outside, >>> but the include function is making everything in file.jl visible. >>> >>> Thanks, >>> >>> Davide >>> >>>