Generic Programming with Concepts
Doktorsavhandling, 2008

Generic programming is an indispensable ingredient of modern programming languages. In the C++ programming language, generic programming is implemented by the means of parameterized fragments of code, called templates, in which parameters are constrained by concepts. This thesis consists of seven publications investigating different aspects of generic programming with concepts---formal semantics of the concepts language feature, the mathematical foundations of concepts as a specification tool, change impact analysis of generic libraries, performance-based component composition, and multi-paradigm, multi-language library development. Formally specifying the semantics of programming languages is a difficult task, one that is taken up rarely due to its complexity. In this thesis we provide a formal semantics of the separate type checking with concepts. We also describe some potential problems we discovered while translating the informal wording into formal rules. A formal semantics, such as ours, makes it easier to discuss language design, to improve the quality of the informal specification, and may serve as a model for compilers and other tools. Concepts as institutions is another view on the semantics of concepts we provide in this thesis. Institutions describe the parts of logics: signatures are the vocabulary, sentences are phrases that can be said given a vocabulary, and models are the subjects of the phrases. The institutions of concepts we provide make concepts into logics; the most basic general institution frames concepts as signatures and concept maps as sentences and models at the same time. The logic view on concepts makes it possible to apply techniques from the field of algebraic specification in the realm of C++ programming. Generic programming with concepts also requires more practical support: in this thesis we describe a conceptual change impact analysis for generic libraries and a tool for performance-based component composition. Our change impact analysis is applied at the specification level of a generic library, which comprises the underlying concept hierarchy and generic interfaces of library functions and data structures. We apply the analysis to a real and important problem, a proposed change to the iterator concepts hierarchy of the Standard Template Library of C++. Our component composition tool addresses the issue of combining generic components. We provide a tool that learns from experiments and automatically selects the combination of components expected to be the best in a given situation---a case study is provided for our fast Fourier transform library. Finally, we consider multi-paradigm development of generic libraries. We investigate how the datatype-generic paradigm applies to an imperative language such as C++: we provide a possible solution and outline the important differences between C++ and a functional language that must be taken into account. We also consider similarities between generic programming in Haskell and C++: based on a particular library we provide a translation from Haskell generic interfaces to the corresponding interfaces in C++.






Room EE (in the EDIT building), Rännvägen 6B, Chalmers University
Opponent: Professor Gregor Snelting, Fakultät für Informatik, Universität Karlsruhe, Germany


Marcin Zalewski

Chalmers, Data- och informationsteknik, Programvaruteknik (Chalmers)

Multi-Language Library Development. From Haskell Type Classes to C++ Concepts.

Multiparadigm Programming with Object-Oriented Languages, an ECOOP workshop,; (2007)

Paper i proceeding

Change Impact Analysis for Generic Libraries

ICSM 2006: 22nd IEEE International Conference on Software Maintenance; Philadelphia, PA; United States; 24 September 2006 through 27 September 2006,; (2006)p. 35-44

Paper i proceeding

Scrap++: Scrap Your Boilerplate in C++

Workshop on Generic Programming,; (2006)

Paper i proceeding

C++ concepts as institutions: A specification view on concepts

ACM SIGPLAN Symposium on Library-Centric Software Design LCSD'07, co-located with the Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'07),; (2007)p. 76-87

Paper i proceeding

Rapid performance prediction for library components

Proceedings of the Fourth International Workshop on Software and Performance, WOSP'04; Redwood Shores, CA; United States; 14 January 2004 through 16 January 2004,; (2004)p. 69-73

Paper i proceeding

A Semantic Definition of Separate Type Checking in C++ with Concepts

Journal of Object Technology,; Vol. 8(2009)p. 105-132

Artikel i vetenskaplig tidskrift



Datavetenskap (datalogi)



Doktorsavhandlingar vid Chalmers tekniska högskola. Ny serie: 2857

Technical report D - Department of Computer Science and Engineering, Chalmers University of Technology and Göteborg University: 46

Room EE (in the EDIT building), Rännvägen 6B, Chalmers University

Opponent: Professor Gregor Snelting, Fakultät für Informatik, Universität Karlsruhe, Germany

Mer information