[fpc-devel] Templates / Generics

Bram Kuijvenhoven kuifwaremailinglists at xs4all.nl
Mon Nov 7 19:29:51 CET 2005


Micha Nelissen wrote:
> On Mon, 07 Nov 2005 14:45:19 +0100
> Bram Kuijvenhoven <kuifwaremailinglists at xs4all.nl> wrote:
>>Does <> for generics fit into Pascal? Well, we use [] for array indexing, and () for parameter passing to procedures/functions/methods. So why not use <> for passing parameters to generic types? And, similar to the case of function calls and array indexing, these <> could follow the type identifier directly.
> 
> You got a point here, but the "where T is Foo" stuff is crap then, don't you
> agree?
> 
> TGType<T: TBaseType> = class(...) ... end;
> 
> is better then, when compared to your parameter example.

I indeed don't like the "where T is foo" of Chrome :) So you are totally right, TGType<T : TBaseType> is a lot better and a lot more consistent (with e.g. function parameter syntaxis).

Bram



More information about the fpc-devel mailing list