julia> struct Field
name::Symbol
typ::Type
Field(name::Symbol,typ::Symbol) = new(name,eval(typ))
end
julia> #no need to check the type! closest
function Base.broadcast(::typeof(==),f1::Field,f2::Field)
isequal(f1.name,f2.name)
end
julia> Base.hash(f::Field, h::UInt) = hash(f.name, hash(Field,h))
julia> f1 = Field(:a,:Int)
Field(:a, Int64)
julia> f2 = Field(:a,:Float64)
Field(:a, Float64)
julia> f1 == f2
false
I don’t understand what is going wrong, Can someone help me out?
Thanks