[Pre-RFC] named arguments

It’s not necessarily complex functions, just that an argument would be the default 90%+ of the time.

Let’s take https://github.com/Keats/jsonwebtoken/blob/master/src/lib.rs#L104 as an example. It is not a complex signature but in the basic case validation will be Validation::default() so my ideal signature would be fn decode<T: DeserializeOwned>(token: &str, key: &[u8], validation = &Validation::default()). I’m not going to create an empty struct for my functions that have a default argument, that’s a UX nightmare.

Regardless, this thread is about named argument so an example specific to named argument without default argument is readibility/maintenant. For example, a method on a struct taking a bool as an argument (or 2). I think it’s fairly uncontroversial that being able to write this made up method self.render_page(&page, with_livereload=true) is more readable than self.render_page(&page, true) as there is no need to go to the definition to see what the bool corresponds to. It could use an enum but that’s overkill when it’s a simple bool.

I personally view the builder pattern as an (ugly) workaround the lack of named/default parameters so I’m probably biased.