JuliaLang/julia

== for immutables should recursively call == on its fields

Aperta

#4648 aperta il 26 ott 2013

 (60 commenti) (44 reazioni) (1 assegnatario)Julia (5773 fork)batch import
breakingequalityhelp wantedneeds decision

Metriche repository

Star
 (48.709 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

This doesn't make much sense:

julia> immutable Foo{T}
         bar::T
       end

julia> Foo("baz") == Foo("baz")
false

julia> Foo("baz").bar == Foo("baz").bar
true

julia> Foo(1) == Foo(1)
true

If the fields are == to each other then the objects should be == to each other.

Guida contributor