[fpc-pascal] type constraints in generics?

leledumbo leledumbo_cool at yahoo.co.id
Wed Apr 28 07:01:11 CEST 2010


> I would like to limit the actual type in this list to be a child class of
TObject. Is 
> this possible and if yes, how can it be done?

I don't think it's currently supported. It will be, if someone is willing to
do it.

> In a more general question, what are the differences between the FPC 
> generics and the C# generics (the ones used by the newer versions of 
> Delphi)? In addition to the syntax, of course?

To the best of my knowledge, FPC generics are based on C++ one, while C# one
seems to be coming from Java. FPC one is simply hold as a macro by the
compiler when it's declared and written with all generic types resolved when
it's specialized. It's all done at compile time. In C# case, it's the
runtime environment who is responsible for this. That's why C# one is more
dynamic.
-- 
View this message in context: http://old.nabble.com/type-constraints-in-generics--tp28375014p28384859.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.




More information about the fpc-pascal mailing list