I\'m curious if anyone knows why the Scala library stops at 22
with its tuple type Tuple22
?
Does the mysterious number 22
have a s
Limit 22 is one of the dropped features of dotty (Scala 3) which now allows tuples of arbitrary arity:
The limits of 22 for... the maximal number of fields in tuple types have been dropped... tuples beyond
Tuple22
are erased to a new traitscala.TupleXXL
.
For example,
object Main {
def main(args: Array[String]): Unit = {
val tuple: Tuple = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25")
println(tuple.getClass)
println(tuple.size)
}
}
outputs
class scala.TupleXXL
25
For further examples see Add tests for the current tuple API #7633