Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Compiler (Misc)
    • Labels:
      None

      Description

      (quoting Miles Sabin)

      We can encode multiple type parameter blocks on
      methods in current Scala, albeit inefficiently and clumsily,

       def foo[A1, A2][B1, B2](p1 : (A1, B1)) : (A2, B2) = ...
      

      can be encoded as,

       def foo[A1, A2] = new { def apply[X1, X2, B1, B2](p1 : (A1,
      B1))(implicit ev : X1 =:= A1) : (A2, B2) = ... }
      

      (/quoting Miles Sabin)

      Multiple type parameter lists would internally be represented by nested PolyTypes, which is possible due to the NullaryMethodType refactoring. I see two options for type inference:

      1. reduce to single type parameter list by bunching all type parameters together
      2. solve type parameters in batches, so that the concrete type chosen for later type parameters does not influence the inference of earlier type parameters (in lists on the left), au contraire, later type param's inference depends on the types chosen for type params in lists on their left (see also fundeps in haskell)

      see also: named and default type parameters

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                moors Adriaan Moors
                Reporter:
                moors Adriaan Moors
              • Votes:
                13 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated: