Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Implementing signatures for C++
Baumgartner G., Russo V. ACM Transactions on Programming Languages and Systems19 (1):153-187,1997.Type:Article
Date Reviewed: Jun 1 1997

The authors introduce a simple yet powerful extension to C++ for abstracting types and decoupling subtyping and inheritance. They argue that the current dual purpose of the C++ class construct--to define and implement a type, and to serve as the basis for inheritance, type abstraction, and subtype polymorphism--limits programmer flexibility when using dynamic typing. The signature extension is proposed as a mechanism for allowing type and class hierarchies to be structured independently, thereby increasing the flexibility of dynamic typing “without sacrificing the efficiency and security of static typing.”

Signature declarations are used to define abstract types by specifying the member functions that any implementation of the type must have. Implementations may be associated with signatures by signature pointers. Whenever an object pointer is assigned to a signature pointer, the compiler verifies that the object’s class structurally conforms to the signature. Whenever signature member functions are called, the appropriate class member function is invoked.

The paper begins by discussing two problems arising from the use of inheritance as a subtyping mechanism: difficulties in retroactively introducing an abstract base class to an existing class hierarchy, and difficulties in reconciling abstract type hierarchies with the class hierarchies of an implementation. Next, the signature construct is introduced and illustrated.

Detailed descriptions of three techniques for implementing signatures follow. The first two--using a preprocessor and using a compiler front-end implementation--focus on encapsulating class objects with generated interface objects. Detailed outlines of these implementations, with examples, are provided. The third implementation uses back-end support from the compiler. The performance of all three proposed implementations is presented in terms of words of memory and logical operation requirements.

The problems associated with the dual requirements for the class construct in C++ are shown clearly. Using signatures and signature conformance, subtyping and inheritance are separated semantically and their implementations are decoupled. Finally, the authors note similarities and differences between signatures and related constructs in other languages--interfaces in Java, type modules in Trellis/Owl, modules in Modula-2, and interfaces in Modula-3.

Reviewer:  F. L. Friedman Review #: CR120746 (9706-0454)
Bookmark and Share
 
Abstract Data Types (D.3.3 ... )
 
 
C++ (D.3.2 ... )
 
 
Compilers (D.3.4 ... )
 
 
Modules And Interfaces (D.2.2 ... )
 
 
Object-Oriented Programming (D.1.5 )
 
Would you recommend this review?
yes
no
Other reviews under "Abstract Data Types": Date
Data abstraction in programming languages
Bishop J., Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1986. Type: Book (9789780201142228)
Sep 1 1988
Structuring data with Pascal
McArthur W., Crawley J., Prentice-Hall, Inc., Upper Saddle River, NJ, 1992. Type: Book (9780138530600)
Dec 1 1992
Automatic generation and use of abstract structure operators
Sheard T. ACM Transactions on Programming Languages and Systems 13(4): 531-557, 1991. Type: Article
Sep 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