Ability to define function templates

See crazy idea: dispatch on return type · Issue #19206 · JuliaLang/julia · GitHub and the links therein.