
Oh yes, having newly been using C++ at work, I realized they were a "big
something" [1] that enabled you, as it were, to do whatever unstructured
unholy type trickery you want, and yes, even making classes A<B> and A<C>
completely different things. (BUT! We could argue over this fact: Isn't it
also one of the purposes of... Type Families? Where the TF Foo :: * -> *,
can yield to datatypes Foo String and Foo Int being completely different and
unrelated?)
I was more saying that you could roughly "emulate" Haskell classes in C++
with templates (minus a good type security).
[1] Vernacular, isn't it?
2011/6/10 Richard O'Keefe
On 9/06/2011, at 8:02 PM, Yves Parès wrote:
Were templates an original feature of C++ or did they appear in a revision of the langage ?
The latter. "C with classes" did not have multiple inheritance, exceptions, or templates.
Note that C++ templates are *not* the same kind of animal as Eiffel generics or Java generics or Ada generics or Haskell parametric polymorphism. The C++ template language lets you do type-level functional programming, and different instances of a common "type constructor" may in fact have quite different internal structures. C++ templates are NOT 'merely keywords around .. parametric polymorphism', they are a far more dangerous thing.