[fpc-devel] Generics Basics
Daniël Mantione
daniel.mantione at freepascal.org
Wed Nov 9 08:53:01 CET 2005
Op Wed, 9 Nov 2005, schreef Pavel V. Ozerski:
> Hello all,
> I didn't discuss about this idea but now I would say something. Is it
> really important, to integrate templates support into compiler? Maybe
> an external preprocessing utility should be better? I think, an
> integrated complex preprocessor can slow the compiling process very
> much even if a source code doesn't contain these syntax extensions.
> Very rapid compiling was always a great pascal advantage over c++.
> This "improvement" can kill this advantage.
Ok, lets put it blunt. It is absolutely not important to have templates at
all. We've been able to develop top class code of the best kind without
templates.
There's a big risk involved with templates; code bloat. Namely, with
templates, you can instantiate classes without realising that you are
adding tens of kilobytes of code.
I.e. in C++ if you instantiate a vector<class_a *>, vector<class_b *>,
vector<class_c *>, you have three implementations of the vector in your
code, which are all an array of pointers! Surely Pascal's
Tcollection/Tlist is much more efficient.
But...
Templates can save typing. People are demanding them, because there is a
hype. Lack of templates is seen as a deficiency of Pascal against C++.
So we should support them.
Daniël
More information about the fpc-devel
mailing list