For what's it's worth, we originally looked relative first and then absolute, but it was a usability nightmare. This is more explicit and, once you get it, I think much simpler.
On Wed, Jul 23, 2014 at 9:06 AM, Mauro <mauro...@runbox.com> wrote: > got it, tnx > > On Wed, 2014-07-23 at 16:51, Stefan Karpinski <ste...@karpinski.org> > wrote: > > Not quite. Note the initial /. When you do `using M` or `import M` it is > > like `cat /M` – it is relative to the root of the module system, not the > > current level of module. When you do `using .M` it is like `cat M` or > `cat > > ./M` – it is relative to the current module. Otherwise when you wrote > > `using Gadfly` in your package, it would go looking for Gadfly inside > your > > current module, which is unlikely to be where it is – unless you happen > to > > have your own submodule called Gadfly, which is, of course, possible. If > > that's what you wanted, then you would use a relative import: `using > > .Gadfly`. > > > > > > On Wed, Jul 23, 2014 at 8:34 AM, Mauro <mauro...@runbox.com> wrote: > > > >> On Wed, 2014-07-23 at 16:29, Stefan Karpinski <ste...@karpinski.org> > >> wrote: > >> > Main is the root module so /T and ./T are the same thing in Main. > >> > >> but doesn't the same hold for any other "folder"? > >> > >> /MyMod/T and /MyMod/./T are the same thing > >> > >> > On Wed, Jul 23, 2014 at 3:36 AM, Mauro <mauro...@runbox.com> wrote: > >> > > >> >> It still needs relative imports with one dot: > >> >> > >> >> julia> module A > >> >> module B > >> >> foo()=4 > >> >> export foo > >> >> end > >> >> using .B > >> >> foo() > >> >> end > >> >> > >> >> Which is a bit odd. Because at the REPL, which is in module Main, > this > >> >> is not needed. This both works: > >> >> > >> >> julia> module T > >> >> end > >> >> > >> >> julia> using .T > >> >> > >> >> julia> module U > >> >> end > >> >> > >> >> julia> using U > >> >> > >> >> Does anyone know why this difference is? > >> >> > >> >> > >> >> On Wednesday, July 23, 2014 5:56:08 AM UTC+1, ggggg wrote: > >> >>> > >> >>> Ok I see how that works, I wasn't aware of the ..C syntax. That > solves > >> >>> the problem asked about, but I'm left with another question. Take > for > >> >>> example > >> >>> > >> >>> module A > >> >>> module B > >> >>> foo()=4 > >> >>> export foo > >> >>> end > >> >>> foo() > >> >>> end > >> >>> > >> >>> That doesn't work, I get "ERROR: foo not defined" because foo is not > >> >>> actually in the A namespace. But if I add "using B" I get "ERROR: B > not > >> >>> found". So how do I define B inside A, but also have A import the > >> things > >> >>> that B exports? > >> >>> > >> >>> > >> >>>> > >> > >> -- > >> > > -- >