I know that this question it not entirely theoretical, but I think that's the place where is more probable that someone knows the answer.
The question is: is there any OO strong typed language where I could "delay" the definition of the method's arguments types?
I'll write an example. Imagine I want to model abelian additive groups, and I program the following interface:
interface AbelianAdditiveGroup
{
public method add(b final_class) : final_class;
public method additiveInverse() : final_class;
}
Where final_class is a keyword to tell the compiler to use the implementation class, not the AbelianAdditiveGroup or any other intermediate abstract class.
That's an example of what I'm searching. I think that using fixed interfaces or classes as argument types in these methods is a bad approach in a lot of cases because this causes that we have to do multiple runtime type checks in our code.
If there is no language with this feature... is there any good reason for this?
Thanks in advance :) .