Inconsistency in source code of FunctionN


#1

This is not about API, but the source code.
Let’s take Function3 for example:

In the source code of Function3 we have type parameters T1,T2 and T3.

The apply method defined as

def apply(v1: T1, v2: T2, v3: T3): R

but not

def apply(t1: T1, t2: T2, t3: T3): R

and the curried method defined as

  @annotation.unspecialized def curried: T1 => T2 => T3 => R = {
    (x1: T1) => (x2: T2) => (x3: T3) => apply(x1, x2, x3)
  }

but not

  @annotation.unspecialized def curried: T1 => T2 => T3 => R = {
    (t1: T1) => (t2: T2) => (t3: T3) => apply(t1, t2, t3)
  }

so does the tupled method is defined as

  @annotation.unspecialized def tupled: Tuple3[T1, T2, T3] => R = {
    case Tuple3(x1, x2, x3) => apply(x1, x2, x3)
  }

but not

  @annotation.unspecialized def tupled: Tuple3[T1, T2, T3] => R = {
    case ((t1, t2, t3)) => apply(t1, t2, t3)
  }

For source code consistency ,I proposal we changed them all to t1...n but not x1...n or v1....n.

An action could be seen here :https://github.com/scala/scala/pull/7427


#2

good proposal.

by the way, shall we also change trait Function3[-T1, -T2, -T3, +R] to trait Function3[-V1, -V2, -V3, +R] ?


#3

I don’t think so ,we should use T1…N as type parameter ,as it always be used in Function1…N.The inconsistency comes from the method parameter name but not Type parameter itself.