Because == is not explicitly defined on type MyType{T,P} it falls back to:
julia> @less ==(q1,q2)
==(x, y) = x === y
...
therefor false.
There is no implicit == which compares each part of struct. You have to define this for your types, e.g.:
julia> import Base.==
julia> ==(a::MyType{T,P},b::MyType{T,P}) where {T,P} = a.x == b.x && a.y == b.y
== (generic function with 175 methods)
julia> ==(q1,q2)
true
I wouldn’t say that it is because isbits(q1) is false. The type Decimal is because of it’s implementation not a isbitstype and because of it’s implementation === is false in equal values but different variables. But this is somehow esoteric so lets just say:
julia> isbitstype(Decimal)
false
so we expect
julia> Decimal(1) === Decimal(1)
false
I don’t hink it’s somewhere explicit in the docs. Perhaps it helps if you look at the types dump:
julia> dump(Decimal(1))
Decimal
s: Int64 0
c: BigInt
alloc: Int32 2
size: Int32 1
d: Ptr{UInt64} @0x0000000103fa10a0
q: Int64 0
julia> dump(1)
Int64 1