- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.7k
Closed
Description
...if the function name isn't fully qualified or explicity imported
e.g.
> julia +nightly -q --startup-file=no
julia> VERSION
v"1.12.0-DEV.1898"
julia> eval(::Int) = 42
ERROR: cannot define function eval; it already has a value
Stacktrace:
 [1] top-level scope
   @ none:0
 [2] top-level scope
   @ REPL[2]:1
julia> include(::Int) = 0
ERROR: cannot define function include; it already has a value
Stacktrace:
 [1] top-level scope
   @ none:0
 [2] top-level scope
   @ REPL[3]:1
julia> Base.eval(::Int) = 42  # works
julia> Base.include(::Int) = 0  # worksNote the error message is different from trying to extend other methods without qualification e.g.
julia> VERSION
v"1.12.0-DEV.1898"
julia> 1+2  # so Base.+ has been used
3
julia> +(::String) = 42
ERROR: invalid method definition in Main: function Base.+ must be explicitly imported to be extended
Stacktrace:
 [1] top-level scope
   @ none:0
 [2] top-level scope
   @ REPL[3]:1Whereas in v1.11
nickr@RAI-Mac ~/r/r/p/Tropea> julia +1.11 -q --startup-file=no
julia> VERSION
v"1.11.2"
julia> eval(::Int) = 42
eval (generic function with 2 methods)
julia> include(::Int) = 0
include (generic function with 3 methods)Was this a deliberate change?
It broke some of our code that happened to use the name eval (not meaning to extend Base.eval), so wanted to check the new behaviour was intended
d-netto
Metadata
Metadata
Assignees
Labels
No labels