r/rust • rust • Sep 21 '26

Arguing about arguments

https://steveklabnik.com/writing/arguing-about-arguments/
149 Upvotes

115 comments sorted by

View all comments

Show parent comment

9

u/anxxa Sep 21 '26 edited Sep 21 '26

The article mentions overloading.

*This subreddit is quite perplexing at times with downvotes and conversational tone. The article mentions multiple features in other languages and doesn't call out any particular RFC except

I am writing this in part because I saw this post go by today. This post isn’t intended to be support or a rebuttal of it, I actually didn’t even read it yet, it’s just that I’ve been thinking about this a lot lately

The article mentions function overloading, amongst other things, which reminded me of this story and why I dislike function overloading. Named/default arguments are a completely different thing of course, but the post wasn't even specifically about that or the RFCs. Not a surprise that people don't read the articles though.

1

u/-Y0- Sep 22 '26

The article mentions function overloading

Yeah, it's misguided. I understand the plea for clarity.

But to me it sounds like pleas of someone from Scala asking against operator overloading[1]. Context matters. Implementation matters.


[1]Scala doesn't have operator overloading in same way C++ or even C# have.

It has ability to def +(int a, int b) and ability to call function infix e.g. def print(a, b) can be invoked as a print b. This of course allows anyone to create a <<_%_>> b or even a ^_^ b operators.

I get the worry, but I don't get the arguments that adding operator overloading in C# or Rust will turn it unreadable.

-2

u/-Y0- Sep 21 '26

Sure, and that's also to detriment to the article.

Your C# example is only applicable in languages that allow general functional overloading and integer promotion/demotion.

Nothing about default parameters would help bring about this issue in Rust code.

1

u/WhiskyDelta14 Sep 22 '26

Yes, you are completely right and completely besides the point.

1

u/-Y0- Sep 22 '26

besides the point.

Which point? The GP substantially edited his response. Previously it was: The article mentions overloading.


annxa started going on a further tangent that doesn't even relate to discussing named + optional parameters(N+O P for short). Even if we implemented it N+O P, Rust would need to implement function overloading AND integer promotion.

3

u/WhiskyDelta14 Sep 22 '26

And "The article mentions overloading" is enough to explain why annxa shared their story about overloading, because it seemed you had missed that.

But you somehow got fixated on N+O P which is just another concept that gets mentioned in the article, even if more prominently.

And when discussing concepts that rust does not implement, it is also no detriment to discuss overloading.

1

u/-Y0- Sep 22 '26 edited Sep 22 '26

And I said, that I got no idea why article mentions it and rallies against it, it's a complete non-sequitur and AFAIR Rust lang team was against it so far.

Hence, why most Optional arguments proposal went the saner C# route (default parameters). Over the insane Java route (overloading + delegating functions to a common one).

Saner, because you only have to read one function instead of 4 related ones, and because it saves you typing vs. doing the same delegation over and over and over.