If I type it to Int
then the method is overwritten. But the point is that the second method should have a different signature in the positional parameter space. I chose Any
but equally well I could have written e.g.:
f(x::Integer; kwarg) = "integer"
and the same problem would arise.
For a reference: this is not an artificial question but in DataFrames.jl we actually have methods which for “wider” (something like catch-all) method signature take keyword arguments but for narrower signatures did not take keyword arguments (because they were not needed). I initially expected that passing a keyword argument with a more specific type would throw an error (because the narrower function did not accept keyword arguments) - and this would be in line with what the documentation currently says.