FunctionN and ExtensionFunctionN are now abstract classes, not traits

+ Indexing of their type parameters is fixed (should match actual positions in the parameter list)

 The reason to make them classes:
 * This is how they are actually implemented in the JVM back-end (for performance)

 This can be reconsidered later, but seems to be a reasonable solution
This commit is contained in:
Andrey Breslav
2012-06-26 19:47:53 +02:00
parent a10d0e9c2b
commit 1361c70f68
5 changed files with 118 additions and 106 deletions
@@ -52,7 +52,7 @@ public class TuplesAndFunctionsGenerator {
private static void generateFunctions(PrintStream out, int count, boolean extension) {
generated(out);
for (int i = 0; i < count; i++) {
out.print("public trait " + (extension ? "ExtensionFunction" : "Function") + i);
out.print("public abstract class " + (extension ? "ExtensionFunction" : "Function") + i);
out.print("<");
if (extension) {
out.print("in T");
@@ -65,7 +65,7 @@ public class TuplesAndFunctionsGenerator {
out.print(", ");
}
out.print("out R> {\n");
out.print(" public fun " + (extension ? "T." : "") +
out.print(" public abstract fun " + (extension ? "T." : "") +
"invoke(");
for (int j = 1; j <= i; j++) {
out.print("p" + j + ": " + "P" + j);