Table of contents:
- Isn't abstraction bad for performance?
- What is the best language for Generic Programming?
- I can already do Generic Programming in !
1. Isn't abstraction bad for performance? |
No. Abstraction and performance are not diametrically opposed,
although in many programming languages the mechanisms used for
abstraction inhibit compiler optimizations. For instance, the use of
C++ virtual functions, which support Object-Oriented abstractions,
inhibit optimizations across function calls and can drastically affect
performance. C++ templates, on the other hand, allow abstraction but
resolve all calls at compile-time, enabling all of the compiler's
optimizations.
Generic Programming focuses on careful use of abstractions, employing
only those mechanisms that can be torn down by the compiler's
optimizer. These mechanisms, many of which involve C++ templates, have
allowed generic libraries such as the Matrix Template Library, Blitz++, and the Boost Graph Library to perform on par with hand-tuned Fortran codes.
2. What is the best language for Generic Programming? |
Generic Programming is a paradigm that can be followed in many
languages, both mainstream and
academic. C++ is by far the most
popular language for Generic Programming, owing to the success of
the Standard
Template Library and the flexibility of C++
templates. Haskell is also
particularly well-suited for Generic Programming.
ConceptC++
and Jeremy Siek's G
are both designed specifically with Generic Programming in mind. They
are the only languages where concepts and models are directly
expressed as compiler-supported language entities.
The following papers contain an extensive study of existing language
support for Generic Programming:
- Ronald Garcia, Jaakko Järvi, Andrew Lumsdaine, Jeremy Siek, and
Jeremiah Willcock. An Extended Comparative Study of Language Support
for Generic Programming. Journal of Functional Programming,
2006. Note: Accepted.
- Ronald Garcia, Jaakko Järvi, Andrew Lumsdaine, Jeremy G. Siek,
and Jeremiah
Willcock. A
Comparative Study of Language Support for Generic
Programming. In Proceedings of the 2003 ACM SIGPLAN conference
on Object-oriented programming, systems, languages, and applications
(OOPSLA'03), October 2003.
3. I can already do Generic Programming in ! |
Many languages, especially those that inherently support some form of
"generics", can be used to apply the Generic Programming
paradigm. However, no production languages--mainstream or
academic--provide all of the features needed to realize Generic
Programming in a clean, simple way. The following papers contain an
extensive study of existing language support for Generic Programming:
- Ronald Garcia, Jaakko Järvi, Andrew Lumsdaine, Jeremy Siek, and
Jeremiah Willcock. An Extended Comparative Study of Language Support
for Generic Programming. Journal of Functional Programming,
2006. Note: Accepted.
- Ronald Garcia, Jaakko Järvi, Andrew Lumsdaine, Jeremy G. Siek,
and Jeremiah
Willcock. A
Comparative Study of Language Support for Generic
Programming. In Proceedings of the 2003 ACM SIGPLAN conference
on Object-oriented programming, systems, languages, and applications
(OOPSLA'03), October 2003.
|