skip to main content
10.1145/1065010.1065021acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
Article

Essential language support for generic programming

Published:12 June 2005Publication History

ABSTRACT

Concepts are an essential language feature for generic programming in the large. Concepts allow for succinct expression of constraints on type parameters of generic algorithms, enable systematic organization of problem domain abstractions, and make generic algorithms easier to use. In this paper we present the design of a type system and semantics for concepts that is suitable for non-type-inferencing languages. Our design shares much in common with the type classes of Haskell, though our primary influence is from best practices in the C++ community, where concepts are used to document type requirements for templates in generic libraries. Concepts include a novel combination of associated types and same-type constraints that do not appear in type classes, but that are similar to nested types and type sharing in ML.

References

  1. Ada 95 Reference Manual, 1997.]]Google ScholarGoogle Scholar
  2. J.-D. Boissonnat, F. Cazals, F. Da, O. Devillers, S. Pion, F. Rebufat, M. Teillaud, and M. Yvinec. Programming with CGAL: the example of triangulations. In Proceedings of the fifteenth annual symposium on Computational geometry, pages 421--422. ACM Press, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Boost. Boost C++ Libraries. http://www.boost.org/.]]Google ScholarGoogle Scholar
  4. G. Bracha, N. Cohen, C. Kemper, S. Marx, et al. JSR 14: Add Generic Types to the Java Programming Language, April 2001. http://www.jcp.org/en/jsr/detail?id=014.]]Google ScholarGoogle Scholar
  5. K. B. Bruce, A. Schuett, and R. van Gent. PolyTOIL: A type-safe polymorphic object-oriented language. In W. Olthoff, editor, Proceedings of ECOOP '95, number 952 in Lecture Notes in Computer Science, pages 27--51. Springer-Verlag, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. P. Canning, W. Cook, W. Hill, W. Olthoff, and J. C. Mitchell. F-bounded polymorphism for object-oriented programming. In Proceedings of the fourth international conference on functional programming languages and computer architecture, 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. ACM Computing Surveys, 17(4):471--522, 1985.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. M. Chakravarty, G. Keller, S. P. Jones, and S. Marlow. Associated types with class. In Proceedings of the 32nd ACM-SIGACT Symposium on Principles of Programming Languages, POPL 2005, Long Beach, California, pages 1--13. ACM, Jan. 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. K. Chen, P. Hudak, and M. Odersky. Parametric type classes. In LISP and Functional Programming, pages 170--181, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. G. J. Ditchfield. Contextual polymorphism, 1994.]]Google ScholarGoogle Scholar
  11. G. J. Ditchfield. Cforall reference manual and rationale, 1997.]]Google ScholarGoogle Scholar
  12. E. Ernst. gbeta -- a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. PhD thesis, Department of Computer Science, University of Aarhus, AArhus, Denmark, 1999.]]Google ScholarGoogle Scholar
  13. E. Ernst. Family polymorphism. In ECOOP, volume 2072 of Lecture Notes in Computer Science, pages 303--326. Springer, June 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Garcia, J. Järvi, A. Lumsdaine, J. Siek, and J. Willcock. A comparative study of language support for generic programming. In Proceedings of the 18th ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications, pages 115--134. ACM Press, Oct. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. J.-Y. Girard. Interprétation Fonctionnelle et Élimination des Coupures de l'Arithmetique d'Ordre Superieur. Thèse de doctorat d'état, Université Paris VII, Paris, France, 1972.]]Google ScholarGoogle Scholar
  16. J. A. Goguen, T. Winker, J. Meseguer, K. Futatsugi, and J.-P. Jouannaud. Introducing OBJ. In Applications of Algebraic Specification using OBJ. Cambridge University Press, 1992.]]Google ScholarGoogle Scholar
  17. C. V. Hall, K. Hammond, S. L. P. Jones, and P. L. Wadler. Type classes in Haskell. ACM Trans. Program. Lang. Syst., 18(2):109--138, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. International Standardization Organization (ISO). ANSI/ISO Standard 14882, Programming Language C++. 1 rue de Varembé, Case postale 56, CH-1211 Genève 20, Switzerland, 1998.]]Google ScholarGoogle Scholar
  19. J. Järvi, A. Lumsdaine, J. Siek, and J. Willcock. An analysis of constrained polymorphism for generic programming. In K. Davis and J. Striegnitz, editors, Multiparadigm Programming in Object-Oriented Languages Workshop (MPOOL) at OOPSLA, Anaheim, CA, Oct. 2003.]]Google ScholarGoogle Scholar
  20. J. Järvi, J. Willcock, and A. Lumsdaine. Algorithm specialization and concept constrained genericity. In Concepts: a Linguistic Foundation of Generic Programming. Adobe Systems, Apr. 2004.]]Google ScholarGoogle Scholar
  21. M. P. Jones. Type classes with functional dependencies. In European Symposium on Programming, number 1782 in LNCS, pages 230--244. Springer-Verlag, March 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. W. Kahl and J. Scheffczyk. Named instances for Haskell type classes. In R. Hinze, editor, Proc. Haskell Workshop 2001, volume 59 of ENTCS, 2001. See also: http://ist.unibw-muenchen.de/Haskell/NamedInstances/.]]Google ScholarGoogle Scholar
  23. D. Kapur and D. Musser. Tecton: a framework for specifying and verifying generic system components. Technical Report RPI--92--20, Department of Computer Science, Rensselaer Polytechnic Institute, Troy, New York 12180, July 1992.]]Google ScholarGoogle Scholar
  24. D. Kapur, D. R. Musser, and X. Nie. An overview of the tecton proof system. Theoretical Computer Science, 133:307--339, Oct. 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. D. Kapur, D. R. Musser, and A. Stepanov. Operators and algebraic structures. In Proc. of the Conference on Functional Programming Languages and Computer Architecture, Portsmouth, New Hampshire. ACM, 1981.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. D. Katiyar, D. Luckham, and J. Mitchell. A type system for prototyping languages. In Conference Record of POPL '94: 21st ACM SIGPLAN--SIGACT Symposium of Principles of Programming Languages, Portland, Oregon, pages 138--150, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. A. Kennedy and D. Syme. Design and implementation of generics for the .NET Common Language Runtime. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 1--12, Snowbird, Utah, June 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Kershenbaum, D. Musser, and A. Stepanov. Higher order imperative programming. Technical Report 88-10, Rensselaer Polytechnic Institute, 1988.]]Google ScholarGoogle Scholar
  29. U. Köthe. Handbook on Computer Vision and Applications, volume 3, chapter Reusable Software in Computer Vision. Acadamic Press, 1999.]]Google ScholarGoogle Scholar
  30. D. Le Botlan and D. Rémy. MLF: Raising ML to the power of System-F. In Proceedings of the International Conference on Functional Programming (ICFP 2003), Uppsala, Sweden, pages 27--38. ACM Press, aug 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. X. Leroy, D. Doligez, J. Garrigue, D. Remy, and J. Vouillon. The Object Caml Documentation and User's Manual, September 2003.]]Google ScholarGoogle Scholar
  32. B. Liskov, R. Atkinson, T. Bloom, E. Moss, C. Schaffert, B. Scheifler, and A. Snyder. CLU reference manual. Technical Report LCS-TR-225, Cambridge, MA, USA, October 1979.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. B. Liskov and J. Guttag. Abstraction and specification in program development. MIT Press, Cambridge, MA, USA, 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. D. MacQueen. An implementation of Standard ML modules. In Proceedings of the 1988 ACM Conference on LISP and Functional Programming, Snowbird, UT, pages 212--223, New York, NY, 1988. ACM.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. B. Meyer. Eiffel: the Language. Prentice Hall, New York, NY, first edition, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Microsoft Corporation. Generics in C, September 2002. Part of the Gyro distribution of generics for .NET available at http://research.microsoft.com/projects/clrgen/.]]Google ScholarGoogle Scholar
  37. R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. MIT Press, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. J. C. Mitchell. Polymorphic type inference and containment. Information and Computation, 76(2-3):211--249, 1988.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. D. R. Musser and A. Stepanov. Generic programming. In ISSAC: Proceedings of the ACM SIGSAM International Symposium on Symbolic and Algebraic Computation, 1988.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. D. R. Musser and A. A. Stepanov. A library of generic algorithms in Ada. In Using Ada (1987 International Ada Conference), pages 216--225, New York, NY, Dec. 1987. ACM SIGAda.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. G. Nelson and D. C. Oppen. Fast decision procedures based on congruence closure. J. ACM, 27(2):356--364, 1980.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. T. Nipkow. Structured Proofs in Isar/HOL. In H. Geuvers and F. Wiedijk, editors, Types for Proofs and Programs (TYPES 2002), volume 2646, pages 259--278, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. T. Nipkow, L. C. Paulson, and M.Wenzel. Isabelle/HOL --- A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. M. Odersky and al. An overview of the scala programming language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.]]Google ScholarGoogle Scholar
  45. M. Odersky, V. Cremet, C. Röckl, and M. Zenger. A nominal theory of objects with dependent types. In Proc. ECOOP'03, Springer LNCS, 2003.]]Google ScholarGoogle Scholar
  46. M. Odersky and K. Läufer. Putting type annotations to work. In Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 54--67. ACM Press, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. B. C. Pierce. Intersection types and bounded polymorphism. Mathematical Structures in Computer Science, 11, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. B. C. Pierce. Types and Programming Languages. MIT Press, 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. W. R. Pitt, M. A. Williams, M. Steven, B. Sweeney, A. J. Bleasby, and D. S. Moss. The bioinformatics template library: generic components for biocomputing. Bioinformatics, 17(8):729--737, 2001.]]Google ScholarGoogle ScholarCross RefCross Ref
  50. E. Poll and S. Thompson. The Type System of Aldor. Technical Report 11-99, Computing Laboratory, University of Kent at Canterbury, Kent CT2 7NF, UK, July 1999.]]Google ScholarGoogle Scholar
  51. D. Rémy and J. Vouillon. Objective ML: An effective object-oriented extension to ML. Theory And Practice of Object Systems, 4(1):27--50, 1998. A preliminary version appeared in the proceedings of the 24th ACM Conference on Principles of Programming Languages, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. J. C. Reynolds. Towards a theory of type structure. In B. Robinet, editor, Programming Symposium, volume 19 of Lecture Notes in Computer Science, pages 408--425, Berlin, 1974. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. J. Siek, L.-Q. Lee, and A. Lumsdaine. The generic graph component library. In Proceedings of the 1999 ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 399--414. ACM Press, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. J. Siek, L.-Q. Lee, and A. Lumsdaine. The Boost Graph Library: User Guide and Reference Manual. Addison-Wesley, 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. J. Siek and A. Lumsdaine. Essential language support for generic programming: Formalization part 1. Technical Report 605, Indiana University, December 2004.]]Google ScholarGoogle Scholar
  56. J. G. Siek and A. Lumsdaine. Advances in Software Tools for Scientific Computing, chapter A Modern Framework for Portable High Performance Numerical Linear Algebra. Springer, 2000.]]Google ScholarGoogle Scholar
  57. Silicon Graphics, Inc. SGI Implementation of the Standard Template Library, 2004. http://www.sgi.com/tech/stl/.]]Google ScholarGoogle Scholar
  58. A. Stepanov. gclib. http://www.stepanovpapers.com, 1987.]]Google ScholarGoogle Scholar
  59. A. A. Stepanov and M. Lee. The Standard Template Library. Technical Report X3J16/94-0095, WG21/N0482, ISO Programming Language C++ Project, May 1994.]]Google ScholarGoogle Scholar
  60. B. Stroustrup. Parameterized types for C++. In USENIX C++ Conference, October 1988.]]Google ScholarGoogle Scholar
  61. J. Tiuryn and P. Urzyczyn. The subtyping problem for second-order types is undecidable. Information and Computation, 179(1):1--18, 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. M. Troyer, S. Todo, S. Trebst, and A. F. and. ALPS: Algorithms and Libraries for Physics Simulations. http://alps.comp-phys.org/.]]Google ScholarGoogle Scholar
  63. P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad-hoc. In ACM Symposium on Principles of Programming Languages, pages 60--76. ACM, Jan. 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. J. Walter and M. Koch. uBLAS. Boost. http://www.boost.org/libs/numeric/ublas/doc/index.htm.]]Google ScholarGoogle Scholar
  65. J. Willcock, J. Järvi, A. Lumsdaine, and D. Musser. A formalization of concepts for generic programming. In Concepts: a Linguistic Foundation of Generic Programming at Adobe Tech Summit. Adobe Systems, Apr. 2004.]]Google ScholarGoogle Scholar

Index Terms

  1. Essential language support for generic programming

            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
              PLDI '05: Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation
              June 2005
              338 pages
              ISBN:1595930566
              DOI:10.1145/1065010
              • cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 40, Issue 6
                Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation
                June 2005
                325 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/1064978
                Issue’s Table of Contents

              Copyright © 2005 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: 12 June 2005

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • Article

              Acceptance Rates

              Overall Acceptance Rate406of2,067submissions,20%

              Upcoming Conference

              PLDI '24

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader