I am just asking to clarify if this is intentional or a bug:
julia> VERSION
v"0.7.0-beta.44"
julia> using StatsBase: cov
julia> struct Foo end
julia> StatsBase.var(::Foo) = 42
ERROR: UndefVarError: StatsBase not defined
Stacktrace:
[1] top-level scope at none:0
Cf: in v0.6
, StatsBase
is brought into scope.
In 0.6, packages got loaded into Main which is the same module the REPL is working in. This is no longer the case, they get loaded into a non-standard module behind the scenes. That is likely the cause of the difference, but not sure whether the current behavior is actually the desirable one.
Are you sure it has to do anything with Main
? Eg one can get a similar error message by loading
module Bar
using StatsBase: cov
struct Foo end
StatsBase.var(::Foo) = 42
end
I think that @jeff.bezanson changed this so that using X: y
doesn’t cause X
to be imported anymore.
I think this actually makes sense, but it would be great to have it in NEWS.md.
Actually, the manual on modules has
The statement using BigLib: thing1, thing2
brings just the identifiers thing1
and thing2
into scope from module BigLib
.
(my emphasis), so with a careful reading, this is indeed documented. But some extra emphasis would be useful.
Should I open an issue?
Now I double-checked and I am not so sure that there is an issue.
module Bar
using StatsBase: cov
struct Foo end
StatsBase.var(::Foo) = 42
end
errors on both v0.6 and v0.7, while
using StatsBase: cov
struct Foo end
StatsBase.var(::Foo) = 42
only errors only on v0.7, but that is covered in the NEWS.md.