This is exactly what was suggested. Typically in julia you will not use a construction like,
function sqrt(type, value)
if type <: GAlgebra
...
else
...
end
end
rather you will make a
function sqrt(::Type{GAlgebra}, value)
...
end
Even though in the first case the if-test may be eliminated by constant folding/propagation, the second case is cleaner. The if-test is gone, it’s taken care of directly by the compile-time dispatch.