[fpc-pascal] Generics vs TCollection

Michael Van Canneyt michael at freepascal.org
Wed Nov 9 21:08:03 CET 2011



On Wed, 9 Nov 2011, tcoq wrote:

> It's also possible to create a generic descendent of TCollection, where the only duplicated code is the property override. This is probably the best of both worlds: reusing the TCollection while moving to generics.

Hm. I fail to see this: Where is the gain in that ?

Michael.

> Best regards
> Thierry
> ----- Mail Original -----
> De: "michael vancanneyt" <michael.vancanneyt at wisa.be>
> À: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
> Envoyé: Mardi 8 Novembre 2011 13h22:31 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
> Objet: Re: [fpc-pascal] Generics vs TCollection
>
>
> ...
> The difference is mainly that in the case of TCollection(Item) you need to
> override the items property; With generics, you can skip this step.
> At the expense of copying the whole TCollection code each time you create a
> specialized descendent.
>
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>


More information about the fpc-pascal mailing list