[fpc-devel] generics

Danny Milosavljevic danny.milo at gmx.net
Wed Apr 27 12:34:46 CEST 2005


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

-- 
www.keyserver.net key id A334AEA6

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050427/d383db5d/attachment.sig>


More information about the fpc-devel mailing list