skip to main content
10.1145/967900.968198acmconferencesArticle/Chapter ViewAbstractPublication PagessacConference Proceedingsconference-collections
Article

Type-safe covariance in C++

Published:14 March 2004Publication History

ABSTRACT

We present a programming technique for implementing type safe covariance in C++. In a sense, we implement most of Bruce's matching approach to the covariance dilemma in C++. The appeal in our approach is that it relies on existing mechanisms, specifically templates, and does not require any modification to the existing language. The practical value of the technique was demonstrated in its successful incorporation in a large software body. We identify the ingredients of a programming language required for applying the technique, and discuss extensions to other languages.

References

  1. K. Arnold and J. Gasling. The Java Prog. Lang. Addison-Wesley, 1996.]]Google ScholarGoogle Scholar
  2. K. Bruce. Increasing JAVA'S expressiveness with this Type and match-bounded polymorphism. On the web6, 1997.]]Google ScholarGoogle Scholar
  3. K. Bruce, L. Cardeli, G. Castagna, T. H. O. Group, G. T. Leavens, and B. Pierce. On binary methods. Theory and Practice of Object Systems, 1(3), 1996.]]Google ScholarGoogle Scholar
  4. K. B. Bruce, A. Fiech, and L. Petersen. Subtyping is not a good "match" for oo lang. In ECOOP'97.]]Google ScholarGoogle Scholar
  5. K. B. Bruce, A. Fiech, A. Schuett, and R. van Gent. PolyTOIL: A type-safe polymorphic oo lang. In ECOOP'95, pp. 27--51.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. L. Cardelli and P. Wegner. On understanding types, data abstractions, and polymorphism. ACM Comput. Surv., 17(4):471--522, Dec. 1985.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. G. Castagna. Covariance and contravariance: conflict without a cause. ACM Trans. Prog. Lang. Syst., 17(3):431--447, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. Chambers and G. T. Leavens. Typechecking and modules for multi-methods. ACM Trans. on Prog. Lang. Syst., 17(6):805--843, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. Colnet and L. Liquori. Match-O, a dialect of Eiffel with Match-Types, pp. 190--201. In TOOLS PACIFIC'00.]]Google ScholarGoogle Scholar
  10. E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable OO Soft. Addison-Wesley, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Y. Gil and Z. Gutterman. Compile time symbolic derivation with C++ templates. In COOTS'98, pp. 249--262.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. Goldberg and D. Robson, Smalltalk-80: The Language and its Implementation. Addison-Wesley, 1983.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. Gotsman and V. Surazhsky. Guaranteed intersection-free polygon morphing. Computers & Graphics, 25(1):67--75, Feb. 2001.]]Google ScholarGoogle ScholarCross RefCross Ref
  14. O. L. Madsen, B. Møller-Pedersen, and K. Nygaard. OO Prog. in the Beta Prog. Lang. Addison-Wesley, 1993.]]Google ScholarGoogle Scholar
  15. B. Meyer. EIFFEL: The Language. Prentice-Hall, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. T. Millstein and C. Chambers. Modular statically typed multimethods. In ECOOP'99, pp. 279--303.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. D. R. Musser and A. Saini. STL Tutorial and Reference Guide. C++ Prog. with the Standard Template Library. Addison-Wesley, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. M. Omohundro The Sather 1.0 Specification, Jan. 1994.]]Google ScholarGoogle Scholar
  19. L. C. Paulson. ML for the Working Programmer. Cambridge University Press, Cambridge, 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. R. Rinat. Type-safe covariant specialization with generalized matching. In The 7th Int. Workshop on Foundations of OO Lang.]]Google ScholarGoogle Scholar
  21. G. Steele. Common Lisp-the Lang. Digital, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. B. Stroustrup. The C++ Prog. Lang. Addison-Wesley. 2nd ed., 1991.]]Google ScholarGoogle Scholar
  23. B. Stroustrup. The C++ Prog. Addison-Wesley, 3rd ed., 1997.]]Google ScholarGoogle Scholar
  24. V. Surazhsky and C. Gotsman. Controllable morphing of compatible planar triangulations. ACM Trans. on Graphics, 20(4):203--231, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. V. Surazhsky and C. Gotsman. Explicit surface remeshing. In Proc. of Eurographics/ACM Siggraph Symp. on Geom. Processing, pp. 17--28.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. C. Szypersky, S. Omohundro, and S. Murer. Engineering a prog. lang.: The type and class system of Sather. Tech. Rep. 93--064, The Int. Comp. Sc. Inst., Berkeley, Ca, Nov. 1993.]]Google ScholarGoogle Scholar
  27. D. A. Watt. Prog. Lang.: Concepts and Paradigms. Prentice-Hall, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. N. Wirth. The prog. lang. Pascal. Acta Inf., 1:35--63, 1971.]]Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Type-safe covariance in C++

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      SAC '04: Proceedings of the 2004 ACM symposium on Applied computing
      March 2004
      1733 pages
      ISBN:1581138121
      DOI:10.1145/967900

      Copyright © 2004 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 14 March 2004

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      Overall Acceptance Rate1,650of6,669submissions,25%

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader