[Pre-RFC] named arguments

interestingly, I'm against this feature completely and I come from a C++ & Java background :slight_smile:

I think this is a question of design trade-offs:

  1. This is indeed a very popular feature in scripting languages which fits with their model of rapid development and less effort on initial design. It also fits scripting languages because they use dynamic typing and therefore named arguments in such a context have more benefits and less visible costs.

  2. C# is an outlier in such discussions because it suffers from acute featureritis - It has basically every possible feature under the sun. I currently work at a C# shop and have to fight with several very stupid anti-features of C# that people claim "makes writing code easier/quicker". For example, static classes make code near impossible to test and regions remove the need to better organize the code (Hey, Let's just put everything in one huge file with tens of thousands LOC and just use regions because we are lazy to use proper logical (namespaces) & physical (file system) organization (end of after work day rant))

  3. In a statically typed lower-lever language such as Rust it is clear that the benefits are fewer and the costs (however marginal people claim) are more noticeable.

Given that Rust has a rich type system that already allows to distinguish parameters the added value becomes marginal at best. and the cost of "there's more than one way to do this" becomes much more noticeable, at least for me.

Honestly, in the vast majority of cases, based on my personal experience & background, I'd consider named arguments a code-smell in the design where the developer didn't consider providing stronger typing for the arguments and/or just has too many parameters which should have been better organized.

4 Likes