Imagine there are a bunch of static methods
(a la C++/Java) defined like:
foo(::Any) = 0
foo(::A) = 1
foo(::T) where (T <: B} = 2
foo(::C) = 3
function trampoline(t)
... large code chunk here that doesn't depend on t...
foo(t)
... more code here that doesn't depend on t...
end
I think this is called the parametric type pattern in the book by Tom Kwong.
I would like to avoid specializing & recompiling trampoline(t) for every invoked parameter type. Is there any manner to avoid that, assuming that foo(x) is a static function (it doesn’t depend on any instance field).