Named arguments increase readability a lot

To be clear, any good keyword arguments feature wouldn't be optional. Every argument either is a positional argument or a (required) keyword argument.

However, it would definitely be a major change, insomuch as it would change the best way to design APIs, to take advantage of the fluency that kwargs give.

To be completely honest, I feel "second class" keyword arguments via anonymous records fit Rust better at this point. If we were pre-1.0 and had carte blanche to just rewrite the entire stdlib to use Swift-style kwargs, I would (probably) support that, because they do help quite a lot for obvious API naming.

But where we are, with a stable language, any kwargs feature is going to feel bolted on, because the majority of the stdlib doesn't use it. Anonymous records (and (almost) equivalently (for API design), struct literals without naming the type), on the other hand, "just" make the option struct pattern easier to use.

13 Likes