[fpc-devel] Generics

Marco van de Voort marcov at stack.nl
Tue Apr 11 09:47:39 CEST 2006


 
> Templates' pros:
> - support of primitive types;
> - flexibility (ability to call non-virtual and non-related methods,
> operators, etc);
> - ability of coding for speed.
> 
> Type erasure generics' pros:
> - No additional generated code, no code bloat;
> - Code is easier to understand (no additional trips for symbol resolution);
> - Easy (possible ;-) to debug.
> - Much easier to implement (in the compiler) ;-)

What I don't understand is all these differences between templates and
generics while the only difference is that for classes you do type erasure.

Note that for reference types you can also do type erasure under FPC _AND_
classes are always reference types.




More information about the fpc-devel mailing list