[fpc-devel] Generics

Bisma Jayadi bisma at brawijaya.ac.id
Thu Apr 13 05:52:40 CEST 2006


>>>It isn't clear to me what the current status about Generics is:
>>>http://www.freepascal.org/wiki/index.php/Generics
>>
>>http://www.dummzeuch.de/delphi/object_pascal_templates/english.html
>>
>>http://community.borland.com/article/0,1410,27603,00.html
> 
> Ingenious! I really feel stupid for not thinking of something that
> simple like this before :-)

Yup, same respond of mine when first time I read these articles. I never knew 
(think?) that Delphi can do something like this. Maybe it looks like a bit hack, 
but I can live with that, and the most important is: it works like the way I 
wanted. Even C++ compiler does (almost) the same trick. :)

Quote:
Templates are converted by the C++ compiler (actually it is done by the 
preprocessor, but who cares about this difference?) into copies of the template 
code. This means that with each usage of a template the whole code for this 
template will be added to the program again. This could explain why C++ programs 
are that large. ;-) But this and other similarly complex processes are 
definitely the reason why C++ compilers are that slow (Typical compile times for 
a few ten thousand lines of code in Delphi: 5-10 seconds, in C++ several minutes).
-----

-Bee-

has Bee.ography at
http://beeography.wordpress.com



More information about the fpc-devel mailing list