@eny: Have you tried any time to read C++ code full of templates?
No, I prefer to work with FPC/Lazarus (although I have done my share of C++ programming...).
I only can say that templates are THE HELL!
I don't necessarily disagree with you. However generics are
not C++ templates.
Unfortunately the reference guide adds to the confusion by saying in Chapter 8: "As of version 2.2, Free Pascal also officially has support for
templates or Generics."
As I mentioned before, generics are an elegant way to create a group of typesafe 'child' classes, based on a generic (no pun intended) class implementation.
Generics have had a rough history though: they worked OK with lazarus 0.9.26, didn't work at all with Lazarus 0.9.27 and have been working OK since Lazarus 0.9.28. I don't know if it was a FPC problem, or Lazarus problem, but with the latest builds they have been working as expected.
And as a final note: they should be used where appropriate
(which is something that applies to all language constructs...)