Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
The art of metaobject protocol
Kiczales G., des Rivières J., Bobrow D., MIT Press, Cambridge, MA, 1991. Type: Book (9780262610742)
Date Reviewed: Aug 1 1992

The authors develop an extension to the Common Lisp Object System (CLOS) that makes the inner workings of CLOS explicit in a set of metaobject protocols (MOPs). The fundamental elements of CLOS programs (classes, slot definitions, generic functions, methods, and so on) are represented as first-class objects that may be modified and manipulated. Moreover, the CLOS programs that constitute the metaobject protocol are constructed with great clarity and care, providing an excellent introduction to programming in CLOS for serious programmers. The CLOS programs that constitute the metaobject protocols form perhaps the most substantial body of well-documented CLOS programs in existence. Thus, readers interested in CLOS as a language and programming methodology may find this book as worthwhile as those who read it simply for its metaobject protocols. Readers interested in object-oriented programming will find this book to be a valuable case study in a particular style of object-oriented programming that differs from Smalltalk and C++ in a number of significant respects.

The first four chapters, constituting part 1 of the book, develop the fundamental features of the metaobject protocol and are the central chapters for the reader interested in the architecture and implementation of the protocol. Chapters 5 and 6, Part 2 of the book, provide a complete specification of the metaobject protocol for CLOS from a reference perspective. Chapter 5 specifies the metaobjects, the inheritance structure of metaobject classes, and the user interface macros, while chapter 6 includes an alphabetical listing of the functions and generic functions that make up the protocol. The documentation of the extensive class library in chapter 6 is well done and can serve as a model of how class libraries should be defined.

Chapter 1 develops an interpreter called Closette for a substantial subset of CLOS. It introduces a metaphor from the theater, distinguishing between on-stage objects seen by the audience and backstage machinery needed to make the on-stage objects behave correctly. Metaobject protocols make the backstage machinery explicitly visible so it can be manipulated by the programmer. A running example involving painted rectangles is introduced as an on-stage program that motivates backstage implementation procedures. The description of Closette in chapter 1, with more than 40 backstage CLOS programs, provides an explicit semantic description of CLOS programming constructs. Secondarily, this well-documented collection of CLOS program sets standards of documentation and style.

Chapter 2, on introspection and analysis, demonstrates how the Closette metaobject protocols of chapter 1 can be used to introduce browsers that allow the user’s program to inspect its own constructs. A browser is a prototypical example of an introspective tool facilitated by metaobject protocols. Writing browsers using metaobject protocols allows them to be more portable than when they are tightly coupled to an internal language implementation. A variety of program analysis tools is developed, including the regeneration of class definitions from a class metaobject, displaying inherited information for a class, regenerating generic functions and method definitions, and finding all generic functions callable for a given class. Other examples in this chapter include the programmatic creation of new classes that have properties specified by parameters, and filtering out certain kinds of automatically generated generic functions and methods to make the process of browsing easier.

Chapter 3, on extending the language, focuses on examples that transform the language. For example, the authors introduce the class “counted class,” which includes an additional slot for counting the number of its instances. In order to use such specialized metaobject classes, the defclass method must be redefined so it can generate nonstandard classes. Mechanisms for programmed specification of class precedence for multiple inheritance and for the programmed specification of slot inheritance are introduced. Chapter 4, on protocol design, shows how protocols can be designed for tasks like generic function invocation, for function and procedure protocols, for overriding the standard method, and for implementing layered protocols. Each of the extensions in chapter 3 and the protocols in chapter 4 is supported by extensive CLOS metaobject protocols.

Metaobject protocols that support extensibility by making the backstage workings of a language explicit are sometimes called “reflective,” since they encourage introspection and analysis. The authors felt the term “reflection” was confusing, preferring the term “metaobject protocols” to capture the idea of explicit description of backstage behavior. Readers should be aware, however, of the close connection between CLOS metaobject protocols and the extensive literature on reflection for LISP and object-oriented languages.

This book could become a de facto standard for CLOS semantics and a de facto framework for building extensions to the basic CLOS system. I have no doubt that the MOP will contribute to CLOS standardization not only at the language level but also at the level of language extension. In fact, this seems to be happening already.

The perspective of this work is different from that of traditional object-oriented literature aimed at application programmers in a specific object-oriented language. It deserves to be widely read both because it provides CLOS with a clear semantic foundation and for its rich store of well-documented CLOS programs.

Reviewer:  P. Wegner Review #: CR115766
Bookmark and Share
 
Common Lisp (D.3.2 ... )
 
 
Object-Oriented Languages (D.3.2 ... )
 
 
Object-Oriented Programming (D.1.5 )
 
Would you recommend this review?
yes
no
Other reviews under "Common Lisp": Date
Common LISP: the language (2nd ed.)
Guy L. J., Digital Press, Newton, MA, 1990. Type: Book (9781555580414)
Dec 1 1991
Common LISP modules
Watson M., Springer-Verlag New York, Inc., New York, NY, 1991. Type: Book (9780387976143)
Jun 1 1992
Real-time programming in Common Lisp
Allard J., Hawkinson L. Communications of the ACM 34(9): 64-69, 1991. Type: Article
Dec 1 1992
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy