15-312 Foundations of Programming Languages
Lectures 20-21: Objects
In this lecture we examine the design goals and technical properties of
object-oriented languages. Rather than study languages like Java, which
give up some of the desirable features of functional languages, we will look
at how objects can be added naturally to already powerful functional
languages like ML.
The EML language adds objects to ML by making datatypes and functions
hierarchically extensible. Thus, new constructors can be added to a datatype
after the datatype is initially defined, and cases can be added to functions
over that datatype to handle the new constructors
after the functions are initially defined. Instead of a flat set of
datatype constructors, the constructors are organized into a hierarchy of
classes, so that code written for a superclass can be reused when it is
applied to instances of the subclass. Classes in EML define their own
types, making it possible to define functions that operate on a subset
of the classes in a hierarchy.
We define the operational semantics of EML by giving the rules that are
new with respect to MinML. We also discuss typechecking algorithms for EML,
beginning with a global algorithm, and showing how the algorithm can be
made modular.
[ Home
| Schedule
| Assignments
| Software
| Resources
]
fp@cs
Frank Pfenning
|