[fpc-devel] Suggestion: reference counted objects
Michael Van Canneyt
michael at freepascal.org
Sat Sep 20 14:25:43 CEST 2014
On Sat, 20 Sep 2014, Sven Barth wrote:
> On 20.09.2014 13:11, Peter Popov wrote:
>> Please do not reference count TObject. This is a uniquely bad and
>> unnecessary idea. I will switch to ANSI C if you guys do it
>
> Please enlighten me why you think it is bad.
Simple:
For one, it will slow down your code.
There will be lots of incr/decr of reference counts, just as for ansistrings.
Secondly, there is lots of code that stores objects in lists of pointers and vice versa.
Checking such existing code for side effects by the sudden introduction of TObject
may take ages.
So reference counting TObject by default is IMHO out of the question.
I am not against a reference counted class (the idea exists since ages).
But the solution is IMHO to invent a new attribute or whatever, to allow
people to make an arbitrary class (and it's descendents) reference counted.
Michael.
More information about the fpc-devel
mailing list