The problem is with large modules which export a lot of things, including one or two which will conflict with another module. I don’t think you can do
using AModule
for everything and then use import
only for the conflicting name. Once there is a conflict, you have to explicitly import everything. (Am I perhaps misinterpreting the rules here? At least this is what my experiments tell me. There is no error, but there’s always a warning.) That is a hassle, and that is why I longed for using except
.
module AModule
export fun, notfun
function fun()
println("AModule fun")
end
function notfun()
println("AModule notfun")
end
end
module BModule
export fun, alwaysfun
function fun()
println("BModule fun")
end
function alwaysfun()
println("BModule alwaysfun")
end
end
using .AModule
fun()
using .BModule
BModule.fun()
alwaysfun()
gives
julia> include("test/playground.jl")
AModule fun
WARNING: using BModule.fun in module Main conflicts with an existing identifier.
BModule fun
BModule alwaysfun
EDIT: THIS IS A NON-ISSUE. SEE BELOW IN STEFAN’S EXPLANATION.