further infos: http://qc.borland.com/wc/qcmain.aspx?d=11168
Danny Milosavljevic wrote:
Hi,
I'm trying to add support for generics (templates) to fpc.
Do we want to have a "generics" section (like "interface", "implementation") or do we want a special source code type (like "unit", "program") in the source code ?
I'm tending to a special source code type "generic unit".
The generic source code file (.pas,.pp) is installed (not the .ppu,.o). Then in the 'uses' handler, when not finding a ppu, it reverts to the pas file, and then finds that it is a special source code "generic unit" or so, so it *doesnt* compile it right now, but 'uses' actually just registers the generic classes as 'available for compilation later'.
When first using a specialization declaration like 'GList<Integer>', _then_ it is compiled (after injecting the specialization types to use) (where to? a special .o file like glist-system-integer.o or glist-someunit-someclass.o ? use a .ppu too ? I guess so)
I'm leaving "advanced" features out for now, like "any" types (variant-interface to a generic), although it could be argued that the generic class could compile using the "any" types (most likely "Variant") later.
Opinions?
cheers, Danny
------------------------------------------------------------------------
_______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
_______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
