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.
- Ada 95 Reference Manual, 1997.]]Google Scholar
- 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 ScholarDigital Library
- Boost. Boost C++ Libraries. http://www.boost.org/.]]Google Scholar
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. ACM Computing Surveys, 17(4):471--522, 1985.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- K. Chen, P. Hudak, and M. Odersky. Parametric type classes. In LISP and Functional Programming, pages 170--181, 1992.]] Google ScholarDigital Library
- G. J. Ditchfield. Contextual polymorphism, 1994.]]Google Scholar
- G. J. Ditchfield. Cforall reference manual and rationale, 1997.]]Google Scholar
- 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 Scholar
- E. Ernst. Family polymorphism. In ECOOP, volume 2072 of Lecture Notes in Computer Science, pages 303--326. Springer, June 2001.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- D. Kapur, D. R. Musser, and X. Nie. An overview of the tecton proof system. Theoretical Computer Science, 133:307--339, Oct. 1994.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- A. Kershenbaum, D. Musser, and A. Stepanov. Higher order imperative programming. Technical Report 88-10, Rensselaer Polytechnic Institute, 1988.]]Google Scholar
- U. Köthe. Handbook on Computer Vision and Applications, volume 3, chapter Reusable Software in Computer Vision. Acadamic Press, 1999.]]Google Scholar
- 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 ScholarDigital Library
- X. Leroy, D. Doligez, J. Garrigue, D. Remy, and J. Vouillon. The Object Caml Documentation and User's Manual, September 2003.]]Google Scholar
- 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 ScholarDigital Library
- B. Liskov and J. Guttag. Abstraction and specification in program development. MIT Press, Cambridge, MA, USA, 1986.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- B. Meyer. Eiffel: the Language. Prentice Hall, New York, NY, first edition, 1992.]] Google ScholarDigital Library
- 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 Scholar
- R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. MIT Press, 1990.]] Google ScholarDigital Library
- J. C. Mitchell. Polymorphic type inference and containment. Information and Computation, 76(2-3):211--249, 1988.]] Google ScholarDigital Library
- D. R. Musser and A. Stepanov. Generic programming. In ISSAC: Proceedings of the ACM SIGSAM International Symposium on Symbolic and Algebraic Computation, 1988.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- G. Nelson and D. C. Oppen. Fast decision procedures based on congruence closure. J. ACM, 27(2):356--364, 1980.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- T. Nipkow, L. C. Paulson, and M.Wenzel. Isabelle/HOL --- A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002.]] Google ScholarDigital Library
- M. Odersky and al. An overview of the scala programming language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.]]Google Scholar
- 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 Scholar
- 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 ScholarDigital Library
- B. C. Pierce. Intersection types and bounded polymorphism. Mathematical Structures in Computer Science, 11, 1996.]] Google ScholarDigital Library
- B. C. Pierce. Types and Programming Languages. MIT Press, 2002.]] Google ScholarDigital Library
- 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 ScholarCross Ref
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- J. Siek, L.-Q. Lee, and A. Lumsdaine. The Boost Graph Library: User Guide and Reference Manual. Addison-Wesley, 2002.]] Google ScholarDigital Library
- J. Siek and A. Lumsdaine. Essential language support for generic programming: Formalization part 1. Technical Report 605, Indiana University, December 2004.]]Google Scholar
- 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 Scholar
- Silicon Graphics, Inc. SGI Implementation of the Standard Template Library, 2004. http://www.sgi.com/tech/stl/.]]Google Scholar
- A. Stepanov. gclib. http://www.stepanovpapers.com, 1987.]]Google Scholar
- 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 Scholar
- B. Stroustrup. Parameterized types for C++. In USENIX C++ Conference, October 1988.]]Google Scholar
- J. Tiuryn and P. Urzyczyn. The subtyping problem for second-order types is undecidable. Information and Computation, 179(1):1--18, 2002.]] Google ScholarDigital Library
- M. Troyer, S. Todo, S. Trebst, and A. F. and. ALPS: Algorithms and Libraries for Physics Simulations. http://alps.comp-phys.org/.]]Google Scholar
- 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 ScholarDigital Library
- J. Walter and M. Koch. uBLAS. Boost. http://www.boost.org/libs/numeric/ublas/doc/index.htm.]]Google Scholar
- 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 Scholar
Index Terms
- Essential language support for generic programming
Recommendations
A comparative study of language support for generic programming
OOPSLA '03: Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applicationsMany modern programming languages support basic generic programming, sufficient to implement type-safe polymorphic containers. Some languages have moved beyond this basic support to a broader, more powerful interpretation of generic programming, and ...
Essential language support for generic programming
Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementationConcepts 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 ...
A comparative study of language support for generic programming
Special Issue: Proceedings of the OOPSLA '03 conferenceMany modern programming languages support basic generic programming, sufficient to implement type-safe polymorphic containers. Some languages have moved beyond this basic support to a broader, more powerful interpretation of generic programming, and ...
Comments