OK, let’s do this.
Calling foo(1, 2)
calls second method as first accepts only one positional argument - no ambiguity here.
Same as
function foo2(p1::Dog, p2::Cat)
function foo2(p2::Dog, p1::Cat)
currently creates ambiguity for positional arguments but I don’t hear people complaining. Of course if one really wants to create untractable code one wouldn’t need many tools, simple C would do just fine.
Same as currently with positional arguments - the last defined method hides the previous, it’s a simple pattern-matching.
Methods are not ‘overwritten’ but hidden. It’s a pattern matching against the list. The same logic applies with the proposed change. If you want to create a mess you don’t need many features to do this.
Does Julia allow keyword arguments preceding positional arguments in calls? Is there any good reason for this?
This should not be allowed at all.
OK, I admit, the foo(5, K=5;)
syntax that shouldn’t currently work works in ambiguous way and you wanna keep it as it is. The question is there anyone really using foo(5, K=5;)
syntax now because it has no sense?
Same here - shouldn’t currently work, completely useless, but OK, let’s keep the useless ambiguous syntax.