This paper is quite interesting, but unfortunately flawed.
The authors, being too strongly influenced by C++, fail to
properly distinguish two key features of C++ templates:
(1) parametric polymorphism
(2) 'macro expansion' <g>
The very first example turned me off:
template <class T>
const T& pick(const T& x, const T& y)
{if (better(x, y)) return x; else return y; }
Any functional programmer would know that the 'better'
function should be an argument, not resolved by macro
expansion.
Consequently the authors get very confused by
the notion of abstraction, and the argument
for the notion of 'concepts' really shows their confusion:
"the formalization of an abstraction as a set of requirements
on a type (or on a set of types)"
Anyone knowing any basic theory knows this is bogus:
the very notion of abstraction implies types are meaningless
points with no properties, and no relations between them...
What abstraction means is representation of types
by *functions*, and the constraints must be imposed
on the functions. [Cf. category theory]
It is very unfortunate this bogus model is followed
by Stroustrup and is almost certain to be incorporated
in the next ISO C++ Standard.
Despite this, the paper is interesting and worth reading,
for the feature comparisons...even if they didn't get it
quite right.
Of course, they missed the *important* concerns by
concentrating on a bogus view of type constraints.
Most programming languages only support data polymorphism,
not functorial polymorphism, and this is one area where progress
is needed. Crudely, higher order functions like 'map'
have to be redefined for all data structures. Yet clearly,
map is 'parametric' in the data functor, list, tree, or
whatever. See Barry Jay's paper on Functorial ML:
http://www-staff.it.uts.edu.au/~cbj/Publications/functorial_ml.ps.gz
for a way to specify data functors so that map, fold, et al,
are functorially polymorphic.
|