[fpc-pascal]TObjectList.free

Dean Zobec dezobec at tin.it
Sun Feb 15 23:14:12 CET 2004


Alle 12:25, domenica 15 febbraio 2004, Michael.VanCanneyt at Wisa.be ha scritto:
> > > I fixed this. The problem was that the behaviour of Borland's TList
> > changed

> > > - it got (a lot!) slower. In older TList implementations TList.Clear
> > didn't

> I understand their reasons, but it's not so cool if you don't care about
> this event and have a list of 10000 elements. It's a serious performance
> penalty in such case. It would have been better if this behaviour had been
> optional (remember, it appeared only in later Delphi versions). As soon
> as I figure out how, I will change the FPC implementation so this doesn't
> happen unless really needed.

I really appreciate that you noticed the problem. To avoid the problem and 
gain in speed in Delphi I was using a clone of TList without the notification 
mechanism. 
Indeed the way TObjectList was introduced with Delphi 5 was not a clever move 
IMHO.
In that occasion the TList was changed to accomodate the need of the one and 
only descendant TObjectList, which is against any object-oriented design 
rule. 
And worse, as I see it, TObjectList should not be a descendant of TList at 
all. TList was not designed to be an ancestor class like TStrings for 
example. They would be better off creating TObjectList (derived from TObject 
and not TList) as a wrapper class around the TList.
I'm happy I can count on you for things like that.
The more I work with fpc, the more I like it. Thank you for the great work you 
are doing.
Ciao, Dean






More information about the fpc-pascal mailing list