Trying not to overload Base.open

I’m not familiar with how your package is built, but simply defining open does not mean Base.open is imported. It seems you are using Base.open in an included file though, is it possible that the deps/deps.jl file uses the definition from Base (e.g., open(<file>, <mode>))?

$ cat tmp.jl
module tmp

f = "hello"
# uncomment the next line to break things
# include("dep.jl")

function open()
    global f
    println(f)
end

end
$ cat dep.jl
f = open("test.txt", "r") do f
        readline(f)
    end
$ cat test.txt
This is a testline.

Including tmp.jl as it is above will work and you can call tmp.open(). Additionally uncommenting the include for dep.jl will error with the importing message. The solution is to define your open as LCIO.open.

The error message is informing you of a name clash. They can be resolved by clearly stating who owns the new method.

1 Like