[fpc-pascal] Generics vs TCollection
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Tue Nov 8 13:22:31 CET 2011
On Tue, 8 Nov 2011, Graeme Geldenhuys wrote:
> On 8 November 2011 12:13, <michael.vancanneyt at ...> wrote:
>>
>> I have tons of code that uses them. Lazarus has tons of code that uses them.
>> There is no way that we're going to rewrite all that stuff.
>
> Sorry for any confusion. I did not post this with the intention of
> removing TCollection/TCollectionItem classes from FPC. I'm simply
> asking from a functionality point of view. Can Generics replace the
> usage of TCollection/TCollectionItem in all cases? Purely from a
> functionality point of view, it seems like it should be possible - but
> I know nothing of Generics (never used them).
You should see it differently: there is a generics collection which
performs the same function as TCollection/TCollectionitem.
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.
More information about the fpc-pascal
mailing list