[fpc-devel] type discussion

Hans-Peter Diettrich DrDiettrich at compuserve.de
Sun Jun 5 10:53:27 CEST 2005


Danny Milosavljevic wrote:

> > > > Garbage collection is largely no issue when using the Owner concept in TComponent, using TObjectList, etc.
> > >
> > > True and thats why I suggested ref counting Tobjects only so that no
> > > manual memory management is required. I tend to make heavy use of TList,
> > > Tstringlist and TFilestream objects so I cant do everything with
> > > tcomponents alas.
> 
> I'd suggest creating tlist, tstringlist, tfilestream-like things with an
> optional owner (TComponent-like). I've been programming delphi for
> years, and trust me, I know how annoying keeping track of tlist memory
> is (and I mean _annoying like *@! hell_ :)). Of course having to cast
> around list content is even more annoying. But 'm trying to fix that
> now, in fpc.

I've implemented such classes years ago, and according list and tree
view controls for easy display. The classes are derived from TStrings,
widely compatible with the remainder of the VCL. I also use
bidirectional member/owner links, so that a destroyed member can inform
it's owner appropriately, and the display and navigation in trees
requires no further stacks or treeview structures. In fact it's
sufficient to pass a reference to some existing TStrings structure to my
controls, then that structure is displayed automagically, without the
need for hidden copies or other crap, as occurs with the traditional
controls.

DoDi






More information about the fpc-devel mailing list