TYPING OF
?
Encapsulation (Solved: "existential type" [girard 71])
?
Inheritance (Partially Solved)
?
Polymorphism (Open Issue)
Typing inheritance
1.
Covariant Typing
Animal {
Shit Eats (FOOD)
}
COW extends animal {
COWSHIT EATS (Grass)
}
Problem: Not Type Sound
Animal a = new cow ();
Food f = new hamburger ();
a.eat (f);
// Food Poisoning
2.
Contravariant Typing
Animal {
Shit Eats (grass)
}
COW extends animal {
COWSHIT EATS (FOOD)
}
PROBLEM:
Sound But not flexible
3.
Novariant Typing
Animal {
Shit Eats (FOOD)
}
COW extends animal {
Shit Eats (FOOD)
}
PROBLEM:
Worst of Both worlds.