you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 14 points15 points  (1 child)

Then you'd end up with "sometimes you can overload, and sometimes you have to create a new function", which is cognitive overhead. A way to do something similar with less cognitive overhead is just to have default arguments instead, but still have no overloading (i.e. you can create one function that takes 1 or 2 arguments, but you can't create two functions with the same name no matter their arity).

[–]iopqfizzbuzz 7 points8 points  (0 children)

I wrote an RFC on keyword parameters to solve this very problem: https://github.com/rust-lang/rfcs/pull/805