Is
using Module1, Module2
equivalent to
using Module1
using Module2
?
Is the order significant in single line version?
Is
using Module1, Module2
equivalent to
using Module1
using Module2
?
Is the order significant in single line version?
short answer, no
Less short answer: yes, no.
Do you mean that evaluation order in using Module1, Module2
is undetermined? I have a situation where:
using Module1
using Module2
works, but:
using Module2
using Module1
doesn’t. So in my case the single line version can’t be used, right?
I’m not certain, but I would believe that using Module1, Module2
is equivalent to using Module1; using Module2
. So with your example, you can verify this assumption: using Module1, Module2
would work whereas using Module2, Module1
wouldn’t. Is that the case?
While relying on the order may not be good practice, I don’t think that that this is documented. I would guess that in practice using
will load the modules in order.
Maybe open an issue to clarify the docs?
I submitted an issue Semantics of `using` with multiple modules in the same line. · Issue #36090 · JuliaLang/julia · GitHub. I wanted to make sure I’m not missing something obvious first.
It is the case, if order is determined.
You did the right thing — it is best to ask first before opening an issue if you are not sure.