effekt
effekt copied to clipboard
Binding of type parameters in methods
Currently the following program is accepted:
interface Choose {
def choose[A](x: A, y: A): A
}
def c = new Choose {
def choose(x, y) = x
}
We want it to be rejected, because there is no explicit binding of the type parameter in the method definition.
Instead, the user has to write the following, which is already accepted:
interface Choose {
def choose[A](x: A, y: A): A
}
def c = new Choose {
def choose[B](x, y) = x
}
For consistency, we always require users to explicitly bind type parameters. Moreover, the A from the interface appears in error messages in the method definition, which might be confusing.