# Inconsistent Base method overwrite behaviour

**URL:** <https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367>\
**Category:** General Usage\
**Created:** [September 23, 2018, 7:38am UTC](https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367 "2018-09-23T07:38:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![essenciary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/essenciary/32/210469_2.png) [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Post date:** [September 23, 2018, 7:38am UTC](https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367/1 "2018-09-23T07:38:18Z")

</div>

This doesn’t look right to me – looks like methods in `Base` are not automatically loaded until something triggers that, leading to inconsistent behaviour.

```julia
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> function fetch(u)
       # code
       end
fetch (generic function with 1 method)

```

And in a new session:

```julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> fetch
fetch (generic function with 5 methods)

julia> function fetch(u)
              # code
              end
ERROR: error in method definition: function Base.fetch must be explicitly imported to be extended
Stacktrace:
 [1] top-level scope at none:0

```

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [September 23, 2018, 7:48am UTC](https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367/2 "2018-09-23T07:48:38Z")

</div>

This is by design, so you can use Base-names (or other “used” modules) in your code. However, once a name has been resolved to an imported binding, you cannot go back, as your second example shows.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 23, 2018, 9:34am UTC](https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367/3 "2018-09-23T09:34:09Z")

</div>

One rather unfortunate thing is that autocompletions trigger name resolution:

```julia
λ j1 --quiet
julia> seek<\tab>
seek seekend seekstart
julia> seek = 2
ERROR: cannot assign variable Base.seek from module Main
Stacktrace:
 [1] top-level scope at none:0

julia> seekend = 3
ERROR: cannot assign variable Base.seekend from module Main
Stacktrace:
 [1] top-level scope at none:0

```

---

<div class="post-metadata">

**Author:** ![essenciary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/essenciary/32/210469_2.png) [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Post date:** [September 23, 2018, 12:45pm UTC](https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367/4 "2018-09-23T12:45:54Z")

</div>

Yes, exactly, that what was bothering me 🙂

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [September 23, 2018, 5:47pm UTC](https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367/5 "2018-09-23T17:47:45Z")

</div>

Sounds issue-worthy to me.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [November 8, 2018, 3:18pm UTC](https://discourse.julialang.org/t/inconsistent-base-method-overwrite-behaviour/15367/6 "2018-11-08T15:18:35Z")

</div>

The auto completion issue should be fixed by  
[https://github.com/JuliaLang/julia/pull/29962](https://github.com/JuliaLang/julia/pull/29962)
