Hi guys!
I am having problems to understand the mechanism of multiple dispatch. The documentation has the following text:
When a function is applied to a particular tuple of arguments, the most specific method applicable to those arguments is applied. Thus, the overall behavior of a function is a patchwork of the behaviors of its various method definitions. If the patchwork is well designed, even though the implementations of the methods may be quite different, the outward behavior of the function will appear seamless and consistent.
However, let me see if I understood correctly.
Let’s say I have the following type:
T_ECIs = Union{Type{Val{:GCRF}},
Type{Val{:J2000}},
Type{Val{:TOD}},
Type{Val{:MOD}},
Type{Val{:TEME}}}
And then I defined the two following functions:
function rECItoECI(T_ECIo::T_ECIs, T_ECId::T_ECIs, JD_UTC::Number)
...
end
function rECItoECI(T_ECIo::Type{Val{:TEME}}, T_ECId::Type{Val{:TEME}}, JD_UTC::Number)
...
end
In a simplified example, I saw that if I call rECItoECI(Val{:TEME}, Val{:TEME}, 0)
then the second function is selected. However, is it assured that this will always happen? I think I am confusing what “most specific method” means.