Keyword parameters do not participate in dispatch and functions do not specialize on them. The type of the returned value depend on T, therefore if the function takes T as a keyword argument without dispatching/specializing on it, it is not able to infer the type of the returned value without running the function, and this leads to type unstability. Also, there is no guarantee that your f with positional arguments will stay type-stable, I think inference may give up if you add 3 more methods for different types.
3 Likes