help?> ===
search: === == !==
===(x,y) -> Bool
âĄ(x,y) -> Bool
Determine whether x and y are identical, in the sense that no program could distinguish them. First the types of x and y are compared. If those are
identical, mutable objects are compared by address in memory and immutable objects (such as numbers) are compared by contents at the bit level. This
function is sometimes called "egal". It always returns a Bool value.
the vectors are mutable, so their addresses in memory is compared, which means:
julia> a = [1,2]
2-element Vector{Int64}:
1
2
julia> b = a
julia> a === b
true
because b is just an alias of a in this case. In your example, they are different, since modifying one of them wonât change the other.
immutable objects (such as numbers) are compared by contents at the bit level
explains the number and string cases, so I think docs explained this perfectly. It has nothing to do with âsingle elementâ or not, but scalars are canonical example of immutable, so the hand-wavy generalization of â=== compares scalars by valueâ is not wrong (edit: technically still wrong, since you can have mutable <: Number, for example BigInt). But all immutable, not just scalars, are compared by bit content:
julia> a = (2,3)
(2, 3)
julia> b = (2,3)
(2, 3)
julia> a === b
true
not sure whatâs the point of dot, youâre operating on scalar. The type is always compared first in ===, if they are not even of the same type, they canât possibly be âidenticalâ, since Julia goes with nominal typing.