[fpc-devel] Suggestion: reference counted objects

Boian Mitov mitov at mitov.com
Sat Sep 20 19:27:40 CEST 2014

I would propose either a virtual method or attribute that enables disables 
Indeed in our code we have adopted a pattern that implements both:

TMyObject = class
  function HasSomeFunctionality() : Boolean; virtual;


function TMyObject.HasSomeFunctionality() : Boolean;
  Result TypeInfo().HasAttribute( SomeFunctionalityAttribute );

This way you can override the virtual method or just change/supress the 
attribute (In Mitov.TypeInfo advanced RTTI we have added the option to 
suppress attributes etc. ;-) )
Or the attribute can be boolean and use it as On/Off .

With best regards,
Boian Mitov

Mitov Software
-----Original Message----- 
From: Ewald
Sent: Saturday, September 20, 2014 5:15 AM
To: FPC developers' list
Subject: Re: [fpc-devel] Suggestion: reference counted objects

On 09/20/2014 01:42 PM, Sven Barth wrote:
What would be handy is a seperate root class that is always refcounted,
something like TRefcountedObject or something. On the other hand some
directive that makes this class refcounted would also be a good solution
IMO (something that works for refcounting in the same way as $M does for

Just my 5 cents.


fpc-devel maillist  -  fpc-devel at lists.freepascal.org

More information about the fpc-devel mailing list