Nevertheless nobody every proposed to not have overloading…
The reason is simple: People expect that overloading works. Actually, people even expect that “something like overloading” works in case of extension methods! Because overloading “feels natural”, no matter the technical challenges.
People also expect that they can use positional arguments in functions, even all functions have named parameter lists! Even that’s “unsafe” because you can confuse different parameters when they have the same types.
What’s the “easy alternative”?
Nobody proposed anything like that in that thread here until now.
The most realistic counter-proposal so far was actually to deliver a crippled feature—mostly like what they did in C#—and “just” make Tuples
and NamedTuples
completely unrelated types. This feels very unsatisfying!
You’re able to deduce that from a sample of around 10 people? Respect for that statistical insight. (And not even here we have an unambiguous “majority” btw. But decisions about technical innovations aren’t something you can go by majority vote anyway. Otherwise we would still program in assembly to this very day… ).
People who ever used positional arguments in functions would disagree…
Besides that: This feature is not out, so such claims make anyway no sense. You can’t have a mental model of something you never used.
But there is actually a very strong analogy to positional arguments in functions! So my guess would be that most people wouldn’t be surprised that you can pass a unnamed tuple where a named is expected.
But given the previous experience with (named) parameter lists in functions while calling them with positional parameters I guess people would be very surprised if that wouldn’t work. (At least not without additional ceremony. Ceremony that can’t be explained by the language, but needs outright magic that only the compiler could provide in some ad hoc way.)
Come on! Not even I would reach for such a stretch! (And I really love to exaggerate in arguments).
Emm, no.
That’s a contradiction.
If unnamed tuples are named tuples, there can’t be any distinction on the type level.
I hope that’s the case anyway. Because at runtime that should be just “flat structs” no matter what.
Again that argument?
Consequently you would need to ask users to explicitly “convert” positional parameter lists to named parameters on every function call.
That’s just plain ridiculous.
Well, that’s just restating my observation that the super-type of named tuples are ParameterLists
… Because all the things mentioned here are already possible with parameter list.
But I clearly see that reworking the language in that direction is out of scope for this proposal here.
That’s not an issue as this could be done in some follow up (maybe Scala 4, or so).
I would disagree. There is plenty of subtle complexity in here!
Parameter list handling in Scala is already super complex. You would need the exact same complexity to handle “mixed” tuples.
I don’t say that’s undesirable, but that’s nothing you would do in the first iteration of the feature. That’s just to much to ask for in one iteration.