Decorating your modules with baremodule (which does not import Base by default) will cause @reexport to fail with the following error:
ERROR: LoadError: UndefVarError: names not defined
Stacktrace:
[1] top-level scope
@ actual\b.jl:3
[2] include(m::Module, fname::String)
@ Core .\boot.jl:358
[3] top-level scope
@ none:1
in expression starting at actual/b.jl:3
Examples
The following code works:
module b
using Reexport
@reexport using BenchmarkTools
end
The following code does not work:
baremodule b
using Reexport
@reexport using BenchmarkTools
end
Potential Solution
In Reexport.jl/src/Reexport.jl you could refer to Reexport.Base.names rather than to names. This will work with a relatively high probability, since the module Reexport would have to be imported in each context where it is to be used and as such we can qualify Base using the module name.
However, this approach could still fail if someone would import this module followingly:
using Reexport as Re
I suppose that the root cause of this problem is the eval statement in the expression returned by the @reexport macro. Maybe it would be easier to fix the problem there?
Decorating your modules with
baremodule
(which does not importBase
by default) will cause@reexport
to fail with the following error:Examples
The following code works:
The following code does not work:
Potential Solution In
Reexport.jl/src/Reexport.jl
you could refer toReexport.Base.names
rather than tonames
. This will work with a relatively high probability, since the moduleReexport
would have to be imported in each context where it is to be used and as such we can qualifyBase
using the module name.However, this approach could still fail if someone would import this module followingly:
I suppose that the root cause of this problem is the
eval
statement in the expression returned by the@reexport
macro. Maybe it would be easier to fix the problem there?