Inconsistent Base method overwrite behaviour


#1

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

   _       _ _(_)_     |  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:

               _
   _       _ _(_)_     |  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

BUG: cannot assign Base.reduce and others in JUNO julia REPL
#2

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.


#3

One rather unfortunate thing is that autocompletions trigger name resolution:

λ 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

#4

Yes, exactly, that what was bothering me :slight_smile:


#5

Sounds issue-worthy to me.


#6

The auto completion issue should be fixed by