Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1111037.1111064acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article

Specifying C++ concepts

Published: 11 January 2006 Publication History

Abstract

C++ templates are key to the design of current successful mainstream libraries and systems. They are the basis of programming techniques in diverse areas ranging from conventional general-purpose programming to software for safety-critical embedded systems. Current work on improving templates focuses on the notion of concepts (a type system for templates), which promises significantly improved error diagnostics and increased expressive power such as concept-based overloading and function template partial specialization. This paper presents C++ templates with an emphasis on problems related to separate compilation. We consider the problem of how to express concepts in a precise way that is simple enough to be usable by ordinary programmers. In doing so, we expose a few weakness of the current specification of the C++ standard library and suggest a far more precise and complete specification. We also present a systematic way of translating our proposed concept definitions, based on use-patterns rather than function signatures, into constraint sets that can serve as convenient basis for concept checking in a compiler.

References

[1]
Lennart Augustsson. Implementing Haskell Over-loading. In Functional Programming Languages and Computer Architecture, pages 65--73, 1993.
[2]
Matthew H. Austern. Generic Programming and the STL. Addison-Wesley, October 1998.
[3]
Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. Associated Type Synonyms. In ACM SIGPLAN International Conference on Functional Programming, Tallinn, Estonia, 2005. ACM Press.
[4]
Manuel M. T. Chakravarty, Gabriele Keller, Simon Peyton Jones, and Simon Marlow. Associated Types with Class. ACM SIGPLAN Notices, 40(1):1--13, January 2005.
[5]
Gabriel Dos Reis. Generic Programming in C++: The next level. The Association of C and C++ Users Spring Conference, April 2002.
[6]
Gabriel Dos Reis and Bjarne Stroustrup. A Formalism for C++. Technical Report N1885=05-0145, ISO/IECSC22/JTC1/WG21, October 2005.
[7]
Gabriel Dos Reis and Bjarne Stroustrup. Specifying C++ Concepts. Technical Report N1886=05-0146, ISO/IEC SC22/JTC1/WG21, October 2005.
[8]
Jean-Yves Girard. Interprétation fonctionnelle et élimination des coupures de l'arithmétique d'ordre supérieur. Thèse d'État, Université Paris VII, 1972.
[9]
Ronald Garcia, Jaakko Järvi, Andrew Lumsdaine, Jeremy Siek, and Jeremiah Willcock. A Comparative Study of Language Support for Generic Programming. In Proceedings of the 18th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications, pages 115--134. ACM Press, 2003.
[10]
Douglas Gregor, Jeremy Siek, Jeremiah Willcock, Jaakko Järvi, Ronald Garcia, and Andrew Lumsdaine. Concept for C++0x (Revision 1). Technical Report N1849=05-00109, ISO/IEC SC22/JTC1/WG21, August 2005.
[11]
Cordelia V. Hall, Kevin Hammond, Simon Peyton Jones, and Philip L. Wadler. Type classes in Haskell. ACM Transactions on Programming Languages and Systems, 18(2):109--138, 1996.
[12]
International Organization for Standards. International Standard ISO/IEC 14882. Programming Languages - C++, 2nd edition, 2003.
[13]
Mark P. Jones. Qualified Types: Theory and Practice. Cambridge University Press, 1994.
[14]
Richard D. Jenks and Robert S. Sutor. AXIOM: The Scientific Computation System. Springer-Verlag, 1992.
[15]
Stefan Kaes. Parametric Overloading in Polymorphic Programming Languages. In Proceedings of the 2nd European Symposium on Programming, volume 300 of Lecture Notes In Computer Science;, pages 131--144. Springer-Verlag, 1988.
[16]
Simon Peyton Jones. Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, 2003.
[17]
Benjamin C. Pierce and David N. Turner. Local Type Inference. In Symposium on Principles of Programming Languages, pages 252--265, San Diego CA, USA, 1998. ACM.
[18]
John Reynolds. Towards a theory of type structure. In Proceedings of Colloque sur la Programmation, volume 19 of Lecture Notes in Computer Science, pages 408--425, New York, 1974. Springer-Verlag.
[19]
Bjarne Stroustrup and Gabriel Dos Reis. Concepts - Design choices for template argument checking. Technical Report N1522, ISO/IEC SC22/JTC1/WG21, September 2003.
[20]
Bjarne Stroustrup and Gabriel Dos Reis. Concepts - syntax and composition. Technical Report N1536, ISO/IEC SC22/JTC1/WG21, September 2003.
[21]
Bjarne Stroustrup and Gabriel Dos Reis. A Concept Design (rev.1). Technical Report N1782=05-0042, ISO/IEC SC22/JTC1/WG21, April 2005.
[22]
Bjarne Stroustrup and Gabriel Dos Reis. Supporting SELL for High-Performance Computing. In Proceedings of the 18th International Workshop on Languages and Compilers for Parallel Computing, October 2005.
[23]
Jeremy Siek, Douglas Gregor, Ronald Garcia, Jeremiah Willcock, Jaakko Järvi, and Andrew Lumsdaine. Concept for C++0x. Technical Report N1758=05-0018, ISO/IEC SC22/JTC1/WG21, January 2005.
[24]
Alexander Stepanov and Meng Lee. The Standard Template Library. Technical Report N0482=94-0095, ISO/IEC SC22/JTC1/WG21, May 1994.
[25]
Bjarne Stroustrup. Technical FAQ: Why can't I define constraints for my template parameters? http://www.research.att.com/~bs/bs_faq2.html#constraints.
[26]
Bjarne Stroustrup. Parameterized Types for C++. In Proceedings of USENIX C++ Conference, Denver, CO., October 1988.
[27]
Bjarne Stroustrup. The Evolution of C++: 1985-1989. USENIX Computer Systems, 2(3), 1989.
[28]
Bjarne Stroustrup. The Design and Evolution of C++. Addison-Wesley, 1994.
[29]
Bjarne Stroustrup. The C++ Programming Language. Addison-Wesley, special edition, 2000.
[30]
Bjarne Stroustrup. Concept checking - A more abstract complement to type checking. Technical Report N1510, ISO/IEC SC22/JTC1/WG21, September 2003.
[31]
Bjarne Stroustrup. Abstraction and the C++ model. In Proceedings of ICESS'04, December 2004.
[32]
Bjarne Stroustrup. The design of C++0x. C/C++ Users Journal, May 2005.
[33]
S. Tucker Taft, Robert A. Duff, Randall L. Brukardt, and Erhard Ploederer, editors. Consolidated Ada Reference Manual, volume 2219 of Lecture Notes in Computer Science. Springer, 2000.
[34]
Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 60--76, Austin, Texas, USA, 1989.

Cited By

View all
  • (2020)Thriving in a crowded and changing world: C++ 2006–2020Proceedings of the ACM on Programming Languages10.1145/33863204:HOPL(1-168)Online publication date: 12-Jun-2020
  • (2019)Apla Generic Constraint Matching Detection and Verification2019 24th International Conference on Engineering of Complex Computer Systems (ICECCS)10.1109/ICECCS.2019.00030(210-219)Online publication date: Nov-2019
  • (2016)Language Support for Generic Programming in Object-Oriented Languages: Peculiarities, Drawbacks, Ways of ImprovementProgramming Languages10.1007/978-3-319-45279-1_1(1-15)Online publication date: 17-Sep-2016
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '06: Conference record of the 33rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
January 2006
432 pages
ISBN:1595930272
DOI:10.1145/1111037
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 41, Issue 1
    Proceedings of the 2006 POPL Conference
    January 2006
    421 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1111320
    Issue’s Table of Contents
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 January 2006

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. C++ concepts
  2. C++ templates
  3. generic programming
  4. separate compilation
  5. type systems

Qualifiers

  • Article

Conference

POPL06

Acceptance Rates

Overall Acceptance Rate 824 of 4,130 submissions, 20%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)38
  • Downloads (Last 6 weeks)3
Reflects downloads up to 13 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2020)Thriving in a crowded and changing world: C++ 2006–2020Proceedings of the ACM on Programming Languages10.1145/33863204:HOPL(1-168)Online publication date: 12-Jun-2020
  • (2019)Apla Generic Constraint Matching Detection and Verification2019 24th International Conference on Engineering of Complex Computer Systems (ICECCS)10.1109/ICECCS.2019.00030(210-219)Online publication date: Nov-2019
  • (2016)Language Support for Generic Programming in Object-Oriented Languages: Peculiarities, Drawbacks, Ways of ImprovementProgramming Languages10.1007/978-3-319-45279-1_1(1-15)Online publication date: 17-Sep-2016
  • (2015)ReferencesMonte Carlo Frameworks10.1002/9780470685167.refs(711-717)Online publication date: 17-Oct-2015
  • (2014)Extending Type Inference to Variational ProgramsACM Transactions on Programming Languages and Systems10.1145/251819036:1(1-54)Online publication date: 1-Mar-2014
  • (2013)Template metaprogramming techniques for concept-based specializationScientific Programming10.1155/2013/58139721:1-2(43-61)Online publication date: 1-Jan-2013
  • (2013)Instant picklesACM SIGPLAN Notices10.1145/2544173.250954748:10(183-202)Online publication date: 29-Oct-2013
  • (2013)Instant picklesProceedings of the 2013 ACM SIGPLAN international conference on Object oriented programming systems languages & applications10.1145/2509136.2509547(183-202)Online publication date: 29-Oct-2013
  • (2013)GPU Programming in RustProceedings of the 2013 IEEE 27th International Symposium on Parallel and Distributed Processing Workshops and PhD Forum10.1109/IPDPSW.2013.173(315-324)Online publication date: 20-May-2013
  • (2013)Emulating C++0x conceptsScience of Computer Programming10.1016/j.scico.2012.10.00978:9(1449-1469)Online publication date: Sep-2013
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media