thing从这里的子模块中导出所有方法的正确方法是什么(这不起作用):
module Foo
module Bar
thing(x::String) = 1
end
import .Bar: thing
module Baz
thing(x::Int) = 1
end
import .Baz: thing
export thing
end
Run Code Online (Sandbox Code Playgroud)
您必须使它们具有相同的功能。thing不能在同一个名称空间中表示两个不同的事物。
例如:
module Foo
function thing end
module Bar
import ..thing
thing(x::String) = 1
end
module Baz
import ..thing
thing(x::Int) = 1
end
export thing
end
Run Code Online (Sandbox Code Playgroud)