Table of Contents Preface. Glossary of Symbols. 1. Introduction.
A Fable. 2. The Elements of Reflective Class-based Models.
The Set of Objects. 3. Inheritance of Metaclass Constraints.
A Class Is an Object.
Structure of an Object.
The Top of the Inheritance Hierarchy.
An Initial Environment.
Drawing Class Structures.
Fundamental Guarantee of Object-Oriented Programming. 4. Dynamic Aspects of Our Object Model.
Importance of Inheriting Metaclass Constraints.
From the Programmer's Point of View.
Epistemological Argument for Inheritance of Metaclass Constraints.
On Metaclasses That Invoke Instance Methods.
Method Invocation. 5. DTS C++.
Instance Variable Access.
Method Resolution Order.
Parent Method Call.
Cooperative Override Methods.
Serious Order Disagreements.
A Simple Programming Model.
Monotonicity of Implementation Chains.
C++ Basics. 6. Our Metaobject Protocol.
DTS C++ Basics.
Graph Versus Tree Inheritance.
Interface to Our Metaobject Protocol. 7. Cooperation among Metaclasses.
Retrieving the Class of an Object.
Solving a Set of Metaclass Constraints.
Defining Methods of a Class.
Readying a Class.
Example: a Metaclass for Managing the Extent of a Class.
Invoking Methods from Interpreters.
Instance Variable Access.
Example: Creation Time Stamps.
Redispatching a Method.
Requirements for Cooperative Metaclasses. 8. Before/After Metaclasses.
Metaclass for Cooperation.
Notes on the Design of Cooperation.
Conflicts and Library Design.
A Discussion of Parameter Passing.
A Metaclass for Redispatching All Methods.
Example: A Simple Trace Facility.
The Composition Problem. 9. Proxies.
Design of the Before/After Metaclass.
Example: A Simple Metaclass for Thread Safety.
The Purpose of Proxies. 10. Metaclasses for Frameworks.
Design of a Proxy Metaclass.
Properties of Proxies.
Extent Managed Proxies.
Invariant Checking. 11. Release-to-Release Binary Compatibility.
Single Instanced Property.
The Abstract Property.
The Final Property.
Preventing Parent Method Calls.
The Library Compatibility Problem. 12. Conclusion.
Defining Release-to-Release Binary Compatibility.
When Classes are First-Class Objects.
A Comparison of Support in Several Object Models.
Completeness of a Set of Transformations.
Contributions of This Book. Appendix A: Advanced Linearization.
Properties of Linearizations. Appendix B: Handling Apply and Redispatch Stubs.
The Limits of Linearization.
Enhanced Control over Method Dispatch. Appendix C: Rationale for Drawing Conventions. Appendix D: Answers to Selected Exercises. Bibliography. Index. 0201433052T04062001
Example of an Apply Stub.
Example of a Redispatch Stub.
Putting Metaclasses to Work takes a new, evolutionary look at important concepts of object-oriented programming, starting with the development of an object model from fundamental principles. Unique aspects of this object model include a use of metaclasses to encapsulate the implementation of object properties and a support for reuse of metaclasses. Metaclass reuse is based on a new semantics for inheritance that automatically combines metaclasses by using multiple inheritance to compose object properties.
This book provides a concrete demonstration of how metaclasses can be used to increase productivity and reusability in object-oriented programming. A C++-based language for programming metaclasses according to the authors' model is presented and then used throughout the book, allowing the reader to understand the utility and importance of metaclasses within the overall context of object-oriented programming. In addition, this book:
- Presents the theory of reflective class-based object-oriented models
- Introduces a new form of inheritance called Inheritance of Metaclass Constraints
- Discusses the basic metaobject protocol used to program new metaclasses that isolate reusable properties
- Contains useful examples of metaclasses that can be built with metaobject protocol and cooperative metaclasses