Are `Int64` and `Float64` of the same type?

I think the answer is a clear: Well yes but actually no :sweat_smile: It depends on the context.

Both are technically instances of DataType as shown by typeof meaning they have the same data layout.

However in practice, one often wants to differentiate between types (e.g. for specialization) and so there is a another way you can view them: As singleton instances of Type{T}. I think this is really a special case for the isa operator and does not really follow the conventional rules. This is somewhat explained in the manual here:
https://docs.julialang.org/en/v1/manual/types/#man-typet-type

So in some technical sense there are instances of the same type, but in a type theory sense they are singleton instances of an appropriate Type{T} and both things hold simultaneously.

8 Likes