Classes and Mixins

Matthew Flatt, Shriram Krishnamurthi, Matthias Felleisen

ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1998


While class-based object-oriented programming languages provide a flexible mechanism for re-using and managing related pieces of code, they typically lack linguistic facilities for specifying a uniform extension of many classes with one set of fields and methods. As a result, programmers are unable to express certain abstractions over classes.

In this paper we develop a model of class-to-class functions that we refer to as mixins. A mixin function maps a class to an extended class by adding or overriding fields and methods. Programming with mixins is similar to programming with single inheritance classes, but mixins more directly encourage programming to interfaces.

The paper develops these ideas within the context of Java. The results are

  1. an intuitive model of an essential Java subset;

  2. an extension that explains and models mixins; and

  3. type soundness theorems for these languages.




These papers may differ in formatting from the versions that appear in print. They are made available only to support the rapid dissemination of results; the printed versions, not these, should be considered definitive. The copyrights belong to their respective owners.