You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...if the function name isn't fully qualified or explicity imported
e.g.
> julia +nightly -q --startup-file=no
julia>VERSIONv"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# works
Note the error message is different from trying to extend other methods without qualification e.g.
julia>VERSIONv"1.12.0-DEV.1898"
julia>1+2# so Base.+ has been used3
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]:1
Whereas in v1.11
nickr@RAI-Mac ~/r/r/p/Tropea> julia +1.11-q --startup-file=no
julia>VERSIONv"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
The text was updated successfully, but these errors were encountered:
This is certainly due to #55949. Unlike +, eval and include are (and have been) local definitions in the module. Previously, you were modifying the function table for that module's machinery and not doing any shadowing as you may have expected.
🤔 so technically #55949 was a breaking change then, since it has now essentially made eval and include into reserved names, and a package cannot provide functions called eval or include.
This is maybe okay, but it's a breaking change. Eval, in particular, could be a useful name for packages like solvers?
For example: DACE.eval
...if the function name isn't fully qualified or explicity imported
e.g.
Note the error message is different from trying to extend other methods without qualification e.g.
Whereas in v1.11
Was this a deliberate change?
It broke some of our code that happened to use the name
eval
(not meaning to extendBase.eval
), so wanted to check the new behaviour was intendedThe text was updated successfully, but these errors were encountered: