Might anybody be able to explain this?
julia> TypeVar(:T, Union{}, Tuple) == TypeVar(:T, Union{}, Tuple)
false
probably falls back to ===
?
Shouldn't this be egal
since the struct and all the values are immutable?
I don't know, I haven't actually checked - I'm compiling from source at the moment, give me a sec
No rush :)
this ===
fallback is usually to "blame" though for ==
giving false
unexpectedly
yup, falls back to ===
The reason they're different is this
julia> TypeVar(:T, Union{}, Tuple) |> objectid
0x9b328216bd30c6e0
julia> TypeVar(:T, Union{}, Tuple) |> objectid
0xb3dca792ef09a1bc
Hmm, I thought egal
/ ===
for immutable structs was defined by ===
on its fields?
they're not considered egal due to that - and my guess for the reasoning behind that is that while both TypeVar
s describe the same extent, refining them _doesn't_ anymore
also
julia> TypeVar(:T, Union{}, Tuple) |> isimmutable
false
Ah, that's a surprise
Last updated: Dec 28 2024 at 04:38 UTC