[fpc-devel] (ref types / circles) Re: Defer keyword

Ryan Joseph genericptr at gmail.com
Sat May 8 18:23:29 CEST 2021



> On May 8, 2021, at 7:59 AM, Sven Barth via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> It has the exact same problems that my branch had (especially the interaction of reference counted instances with non-reference counted ones).
> 
> Using a variable/parameter/field based approach (like the idea with managed records and default fields) is the more flexible one compared to the type or instance based one and thus it's more favorable.

I still don't understand how the record approach is that much different from a managed class type which calls the same set of management operators.  Can we make a pros-cons list to clear this up and give an example of "especially the interaction of reference counted instances with non-reference counted ones"?

Here's the most recent things we brought up:

- Records can't be cast in a way that would break reference counting (like a managed class being cast to TObject would).
- Generic records would create a proliferation of new types for all classes you wanted managed, so instead of using TFPGList<TSomeObject> you're using TManagedSomeObjectList or TManaged<TFPGList<TSomeObject>>, or worse yet "specialize TManaged<specialize TFPGList<TSomeObject>>"

Otherwise the same set of circular references exists but I'm not sure about your concern about mixing managed types yet.

Regards,
	Ryan Joseph



More information about the fpc-devel mailing list