Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Drop function 22 limit #1758
Functions with more than 22 parameters are now automatically converted to functions taking
This has been achieved using two tricks:
Other things I have tried that did not work out well:
Review by @OlivierBlanvillain ?
In definitions some of the new... methods entered the created symbol while others did not. We now make that distrinction clear in the name.
We know create FunctionN types on demand whenever their name is looked up in the scope of package `scala`. This obviates the need to predefine function traits 23 to 30.
Functions with more than 22 parameters are now automatically converted to functions taking a single object array parameter. This has been achieved by tweaking erasure. Other things I have tried that did ot work out well: - Use a single function type in typer. The problem with this one which could not be circumvented was that existing higher-kinded code with e.g. Funcor assumes that Functon1 is a binary type constructor. - Have a late phase that converts to FunctonXXL instead of doing it in erasure. The problem with that one was that potentially every type could be affected, which was ill-suited to the architecture of a miniphase.
OlivierBlanvillain left a comment
Looks great! I've tried running the full test suite with
def f0(f: (Int, Int, Int) => Int): (Int, Int) => Int = f(0, _, _)
I wonder if we could setup the infrastructure to re-run some tests with custom
I should have mentioned: Only the implemented function traits have tupled and curried methods. The synthetic ones lack them.