|Playlist||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 3 — Envs as objects (2:36)
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.
Object 4 — Exps as objects (4:03)
Converting Exp to objects. See lambda-clos.rkt.
Object 5 — objects as lists (3:19)
The simplistic object encoding supports only a single operation (i.e., a single method) in each object. We can use a table of functions (using a list of tuples) to support module operations (methods), but we have to switch to untyped Plait.
Object 6 —
Values as objects (6:23)
Converting Value to objects, using the new hash-table encoding. See lambda-find.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 8 — object macro (1:47)
Syntactic sugar for the fields-and-methods representation of objects. This sugar provides syntax in Plait that matches the syntax that we’re about to implement as object-oriented Curly. See object-demo.rkt. See also lambda-obj.rkt, which is the object-oriented interpeter using this syntactic form.
Introduces object-oriented Curly, which has objects (and field access and method calls) and not functions (or function calls).
Object 10 — expressiveness (2:10)
An aside showing why our new Curly is just as expressive as the one with functions: both are Turing-complete.
Object 11 — interp examples (6:23)
The new Curly grammar and some examples to explore how interp should work.
Object 12 — interp (3:39)
Implementation of interp for object-oriented Curly. See object.rkt.