I often find myself in a dilemma when creating a helper function that returns a tuple.
On the one hand, I don’t want to create a case class specially for this single function, while on the other hand it’s more difficult to understand/use the return arguments because they are unnamed
(_1, _2, ...)
private def getNames[T] : (String, Map[T, String]) = ???
I propose that it will be possible to name the arguments for these tuples, effectively making them anonymous case classes.
private def getNames[T] : (ownerName : String, memberNameMap : Map[T, String]) = ???
will be equivalent to
final case class $anon[T](ownerName : String, memberNameMap : Map[T, String]) private def getNames[T] : $anon[T] = ???
Bonus: This will also help properly document the
unapply return types which gets confusing in custom
unapply pattern matching.