A comparative study of language support for generic programming

  • Authors:
  • Ronald Garcia;Jaakko Jarvi;Andrew Lumsdaine;Jeremy G. Siek;Jeremiah Willcock

  • Affiliations:
  • Indiana University - Bloomington, Bloomington, IN;Indiana University - Bloomington, Bloomington, IN;Indiana University - Bloomington, Bloomington, IN;Indiana University - Bloomington, Bloomington, IN;Indiana University - Bloomington, Bloomington, IN

  • Venue:
  • OOPSLA '03 Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

Many 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 their extensions have proven valuable in practice. This paper reports on a comprehensive comparison of generics in six programming languages: C++, Standard ML, Haskell, Eiffel, Java (with its proposed generics extension), and Generic C. By implementing a substantial example in each of these languages, we identify eight language features that support this broader view of generic programming. We find these features are necessary to avoid awkward designs, poor maintainability, unnecessary run-time checks, and painfully verbose code. As languages increasingly support generics, it is important that language designers understand the features necessary to provide powerful generics and that their absence causes serious difficulties for programmers.