Personal tools
You are here: Home Events Abstract Archives 2004 Functions, classes and prototypes

Functions, classes and prototypes

DeLesley Hutchins Centre for Intelligent Systems and their Applications School of Informatics University of Edinburgh 4pm 13 January 2004 Room 2511, JCMB, King's Buildings

Despite some overlap, object-oriented and functional methodologies are generally regarded as separate paradigms. OO programming is concerned with classes and inheritance, whereas functional programming is concerned with functions and function composition. The two paradigms are clearly intertwined -- the interface of classes are defined in terms of methods (i.e. functions) while the interface of functions are defined in terms of types (i.e. classes).

Nevertheless, this kind of intertwining can best be described as ``peaceful coexistence'', rather than a more meaningful marriage. I present a new object model in which both functions and classes are regarded as variations on the same underlying construct: the structure. Classes in this model are equivalent to higher-order functions, and inheritance is a form of function currying.

This unification has a number of interesting properties. For one, it eliminates the distinction between types and values. Both types and values are unified into -prototypes-, which have different semantics than traditional notions of types. Inheritance and instantiation are likewise unified into one operation, and an instance becomes a subtype of a class.

Most importantly, this model eliminates distinctions of scale. In addition to virtual methods, it provides a mechanism for declaring virtual classes, which allows large frameworks of interacting classes to be encapsulated and refined as a unit. Framework refinement resolves a long outstanding problem related to the scalability of both functional and object-oriented languages, and provides a clean mechanism for implementing several recent technologies, including aspects, hyperspaces, feature-oriented programming, and product lines.

Document Actions