[fpc-devel] Templates / Generics Syntax

Micha Nelissen micha at neli.hopto.org
Fri Nov 4 16:34:10 CET 2005


Peter Vreman wrote:
> Expiriment, feed g++ code with errors in the statements. With macro's
> those errors won't be show until the macro is used. But with templates
> this is diffent:

Smart indeed :)

> This is more important than the syntactical sugar. The rules where to
> declare generics and how/when they are parsed must be known. The syntax
> can be added in the end.

Yes I understand, that's why I wanted to "invent" some syntax that's 
useful but easier to implement than full-blown semi-macro stuff, I added:

"Implementation of TGenericCollection can be compiled as if (T: 
TCollectionItem) were used."

This should mean the current parser for the implementation is good enough.

"Would this solve the circular dependency ? It seems so to me, because 
one knows at least as much as in current implementation of these 
classes, but I'm no compiler engineer."

And this should mean no 'weird' things can happen with 
interface-implementation semi-cycles.

Are more rules needed than these ?

Micha




More information about the fpc-devel mailing list