It’s purely out of curiosity. There is a code snippet in Revise documentation:
for T in (Float16, Float32, Float64)
@eval sizefloat(x::$T) = sizeof($T)
end
Then, I had this thought for a moment; the following should do the same:
for T in (Float16, Float32, Float64)
global sizefloat(x::T) = sizeof(T)
end
It indeed works. Then I tried removing global keyword(I sometimes play with the language like that and it helps me understand the subject better.) When the code failed without global then I tried replacing for with `let’. ![]()
Thank you for the related topic!