hello, maybe a stupid one, but I failed to find relevant documents…
I have something defined in REPL (with const
), but they’re not accessible within the functions defined within a module. What should I do?
thanks.
hello, maybe a stupid one, but I failed to find relevant documents…
I have something defined in REPL (with const
), but they’re not accessible within the functions defined within a module. What should I do?
thanks.
julia> const a = 1
1
julia> module A
using ..Main: a
println(a)
end
1
Main.A
Pass the variables as arguments to the functions.
wow… where is any documentation about ..Main
???
https://docs.julialang.org/en/v1/manual/modules/index.html#Standard-modules-1
https://docs.julialang.org/en/v0.6.0/manual/modules/#Relative-and-absolute-module-paths-1
oh, it’s about “relative module path”.
so, in your first example, why need ..
before Main
?
I mean, when we use using
inside a module, normally we don’t need that ..
, and it would automatically search “outside”, right?
You don’t need the ..
before Main
. I just tried it.
thx