Abstract
A method definition can be viewed as a logical assertion. Whenever we declare a method as the implementation of an operation, we assert that if the operation is invoked on objects of the appropriate types then the method body will satisfy the specification of the operation. This view of methods as assertions is simple but general. Among its applications are: methods defined on interfaces as well as on classes; an elementary type system for objects that handles multi-methods; and a mechanism for method dispatch based on the desired output type as well as on the types of arguments. Further, these applications are compatible with traditional execution models and implementation techniques. Logical reasoning about methods plays a role at compile time, then gets out of the way.
Preview
Unable to display preview. Download preview PDF.
References
Agrawal, R., DeMichiel, L. G., and Lindsay, B. G. Static type checking of multi-methods. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (1991), ACM. Also published in SIGPLAN Notices, 16(11) (1991), pp. 113–128.
Andreoli, J.-M., and Pareschi, R. Linear objects: logical processes with builtin inheritance. In Proceedings of the Seventh International Conference on Logic Programming (1990), D. H. D. Warren and P. Szeredi, Eds., MIT Press, pp. 495–510.
Bobrow, D. G., DeMichiel, L. G., Gabriel, R. P., Keene, S. E., Kiczales, G., and Moon, D. A. Common Lisp object system specification. Sigplan Notices 23, Special Issue (1988).
Bobrow, D. G., Gabriel, R. P., and White, J. L. CLOS in context: the shape of the design space. In Object Oriented Programming: The CLOS Perspective, A. Paepcke, Ed. MIT Press, 1993, pp. 29–61.
Canning, P., Cook, W., Hill, W., Mitchell, J., and Olthoff, W. F bounded quantification for object-oriented programming. In Functional Programming and Computer Architecture (1989).
Cardelli, L. A semantics of multiple inheritance. Information and Computation, 76 (1988).
Cardelli, L., and Wegner, P. On understanding types, data abstraction and polymorphism. Computing Surveys 17, 4 (1985).
Castagna, G., Ghelli, G., and Longo, G. A calculus for overloaded functions with subtyping. In ACM Conference on LISP and Functional Programming (1992). Full paper to appear in Information and Computation.
Chambers, C. The Cecil language: Specification and rationale. Tech. Rep. 93-03-05, Department of Computer Science, University of Washington, 1993.
Chambers, C. Predicate classes. In Proceedings of the European Conference on Object-Oriented Programming (1993).
Dixon, M. Embedded Computation and the Semantics of Programs. PhD thesis, Stanford University, 1991. Also published as Xerox PARC technical report SSL-91-1.
Goldberg, A., and Robson, D.Smalltalk-80: The Language and its Implementation. Addison-Wesley, Reading, MA, 1983.
Hodas, J. S., and Miller, D. Representing objects in a logic programming language with scoping constructs. In Proceedings of the Seventh International Conference on Logic Programming (1990), D. H. D. Warren and P. Szeredi, Eds., MIT Press, pp. 511-526.
Kiczales, G. Traces (a cut at the “make isn't generic” problem). In Proceedings of International Symposium on Object Technologies for Advanced Software (1993), S. Nishio and A. Yonezawa, Eds., JSST, Springer-Verlag, pp. 27–43. Lecture Notes in Computer Science 742.
Pierce, B. C., and Turner, D. Object oriented programming without recursive types. In ACM Symposium on Principles of Programming Languages (1993).
Shapiro, E., and Takeuchi, A. Object oriented programming in Concurrent Prolog. New Generation Computing 1 (1983), 25–48.
Stroustrup, B. The C++ Programming Language, Second Edition. Addison-Wesley, 1991.
Takashio, K., and Tokoro, M. DROL: An object-oriented programming language for distributed real-time systems. In Proceedings of the Conference on Object-Oriented Programming: Systems, Languages, and Applications (1992), pp. 276–294.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1994 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lamping, J., Abadi, M. (1994). Methods as assertions. In: Tokoro, M., Pareschi, R. (eds) Object-Oriented Programming. ECOOP 1994. Lecture Notes in Computer Science, vol 821. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0052176
Download citation
DOI: https://doi.org/10.1007/BFb0052176
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-58202-1
Online ISBN: 978-3-540-48567-4
eBook Packages: Springer Book Archive