# Trying not to overload Base.open

**URL:** <https://discourse.julialang.org/t/trying-not-to-overload-base-open/37432>\
**Category:** General Usage\
**Created:** [April 12, 2020, 4:00am UTC](https://discourse.julialang.org/t/trying-not-to-overload-base-open/37432 "2020-04-12T04:00:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [April 12, 2020, 5:21am UTC](https://discourse.julialang.org/t/trying-not-to-overload-base-open/37432/2 "2020-04-12T05:21:53Z")

</div>

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>)`)?

```bash
$ 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.

---

_[View the full topic](https://discourse.julialang.org/t/trying-not-to-overload-base-open/37432)._
