Extended playlist (includes optional videos)
|schedule page slides as PDF|
Shows a simplistic encoding of objects as functions, illustrating what it means to treat variants and operations in an object-oriented way (even in a language without “objects”).
Object 2b — Envs as objects (3:13)
OPTIONAL. Uses the function encoding of objects to change the treatment of environments in our interpreter from datatype-oriented style to object-oriented style. This is the beginning of a sequence that builds up the core elements of the “object” concept, but doing so in terms of functions.
OPTIONAL. Converting ExprC to objects. See lambda-clos.rkt.
Object 3 — objects as hashes (4:29)
The simplistic object encoding supports only a single operation (i.e., a single method) in each object. We can use a hash table of functions to support module operations (methods), but we have to switch to untyped #lang plai.
OPTIONAL. Converting Value to objects, using the new hash-table encoding. See lambda-hash-u.rkt.
The final encoding of objects, which avoids higher-order functions by explicitly representing a table of field and a table of methods in each object. The point of avoiding higher-order functions is that we can have a simpler core for just objects without functions—but the encoding starts to get complex.
Object 4b — object macro (4:02)
OPTIONAL. Syntactic sugar for the fields-and-methods representation of objects. This sugar provides syntax in #lang plai that matches the syntax that we’re about to implement as the new book language. See object-demo.rkt. See also lambda-obj-u.rkt, which is the object-oriented interpeter using this syntactic form.
Introduces the new book language, which has objects (and field access and method calls) and not functions (or function calls).
Object 6 — expressiveness (2:10)
OPTIONAL. An aside showing why our new book language is just as expressive as the one with functions: both are Turing-complete.
Object 7 — interp examples (6:21)
The new book-language grammar and some examples to explore how interp should work.
Object 8 — interp (4:05)
Implementation of interp. See object.rkt.