15-312 Foundations of Programming Languages
Lecture 19: Objects
In this lecture we continue the discussion of objects via records
and subtyping starting the last lecture. We model open recursion
(also known as late binding of self) and show how this form of
inheritance breaks encapsulation. In terms of creating libraries,
this anti-modularity feature has to be carefully considered in order
to lead to evolvable and maintainable code in languages such as Java.
We also briefly talk about overloading, another feature present
in some object-oriented languages. In Java, overloading is resolved
statically (at compile-time), while in Haskell it is resolved
dynamically. Again, this needs to be carefully considered when
writing code that takes advantage of overloading. From a type-theoretic
perspective, overloading can be explained via intersection types.