LoadError: error in method definition: function Base.min must be explicitly imported to be extended


#1

Hi everybody,
I’m working under Julia 0.5.1 and I face this problem below:

Error evaluating AirplaneRealStats5.9.jl
LoadError: LoadError: error in method definition: function Base.min must be explicitly imported to be extended
while loading C:\Users\sbouiw.ADS-IRO.002\Desktop\Airplane-V5.9\collectors.jl, in expression starting on line 480
while loading C:\Users\sbouiw.ADS-IRO.002\Desktop\Airplane-V5.9\AirplaneRealStats5.9.jl, in expression starting on line 3
 in include_from_node1(::String) at loading.jl:488
 in include_string(::String, ::String) at loading.jl:441
 in include_string(::Module, ::String, ::String) at eval.jl:32
 in (::Atom.##59#62{String,String})() at eval.jl:81
 in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30
 in withpath(::Function, ::String) at eval.jl:46
 in macro expansion at eval.jl:79 [inlined]
 in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60

#2

Presumably you are trying to adding a method to Base.min function.
As the error message indicates, you need to explicitly import Base.min.

Example:

type MyType
    x::Int
end
import Base.min
min(a::MyType, b::MyType) = min(a.x, b.x)

or else fully specify:

Base.min(a::MyType, b::MyType) = min(a.x, b.x)

#3

Note also that generally speaking, it is unnecessary to extend the min function; just extend < or isless as appropriate (see the documentation for when to extend each).


#4

Perfect.error solved. Thank you for your reactivity