[Pre-RFC] Keyword arguments

In my opinion (which I’ve explained before, not that anyone cares), freeform overloading is bad, keyword and optional arguments are good. Objective-C like mandatory keywords are nice for self-explanatory code, at least if you have an IDE, but very different from regular keywords+optionals, because they only achieve the same purpose (allow you to omit arguments) if you add overloading. (You’ll notice that most Objective-C methods are highly verbose and take a lot of arguments…) Python-like keywords+optionals are a good way to not have to create a bunch of helper methods to do the same thing with slightly different variations on how much is specified, but that’s exactly what overloading forces you to do.

However, Python’s system has problems, especially related to the propagation of arguments and defaults to wrapper methods. I think my preferred system would basically be a way to mark a function so that it automatically creates an argument wrapper struct when called (which can then be passed directly to other functions without re-specifying each argument, etc…).

1 Like