Home Assignments Lecture Blog Resources Project

91.301 Organization of Programming Languages
Prof. F. Martin

Problem Set 6: Type Systems

Overview

This problem set introduces three ways to build type systems in Scheme: generic operations with explicit dispatch, data-directed style, and message-passing style.

Reading

Before doing this problem set, read the following material:

Implementation

Use Module language in Dr. Scheme 4.x for this problem set.

Use this starter code for completing the work.

Problems

1. Exercise 2.76 on pp. 187, a discussion of the three strategies presented in the text. Before answering the questions, briefly define the three strategies.

2. Exercise 2.77 on pp. 192–193 on complex-number selectors in type table.

3. Exercise 2.78 on pp. 193, implementing our scheme-number type natively.

4. Exercise 2.79 on pp. 193, implementing a generic equality predicate.

5. Exercise 2.81 on pp. 200, fixing apply-generic so that it doesn't coerce two arguments of the same type.

6. Exercise 2.83 on pp. 201, raising objects’ type per the “tower of types.”

7. Exercise 2.84 on pp. 201, modifying apply-generic to coerce arguments to a higher type in the tower.