Am 10.01.2018 05:10 schrieb "Ryan Joseph" <r...@thealchemistguild.com>:
> On Jan 10, 2018, at 6:37 AM, Graeme Geldenhuys < mailingli...@geldenhuys.co.uk> wrote: > > When using the Generics.Collections unit of Delphi I can define a list class that can hold Integer data types, by doing the following: > > var > IntList: TList<Integer>; > begin > IntList := TList<Integer>.Create; > IntList.Add(12345); I presume then TList<> and TList class are not implemented the same then because I still don’t know how the generic itself affects runtime performance. Btw this looks like C# code because C# explicitly does not specialize at compile time but rather runtime so every instance will be using TList<Integer>. Does Delphi do this also? I think FPC requires you MUST specialize at compile time so simply using TList<Integer> won’t compile. That are two orthogonal points. FPC and Delphi both allow inline specializations which is what you see above (in the non-Delphi modes of course with the "specialize" keyword). That doesn't change that such specializations are done at compile time. For the compiler it is as if the type "TList<Integer>" exists as a full type wherever it is used. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal