> On Mar 9, 2018, at 3:55 AM, Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> 
> wrote:
> 
> My first question....
>     What is a managed record?
> 
> My second question....
>     Why would I need it?
> 
> My third question.....
>     What is different compared to a "normal record"
>     and compared to FPC's Object data type. eg:  TSomeObject = object;
> 

I think the proper term is "management operators” for records which basically 
tell you when records are going in and out scope. The obvious use for them is 
ARC-like systems to manage reference counting. There’s probably other 
interesting things you could do with them we haven’t figured out yet.

I’m still sticking with Apple’s Cocoa model of the auto-release pool that adds 
temporary data to a list and dumps it after every even cycle. Easy, doesn’t 
require new languages features. It’s a stupid waste of resources but that’s 
modern computing in a nutshell.

> 
> Or is this all about trying to follow Delphi again because they broke the 
> Object Pascal "Object" type and then reintroduced that same functionality 
> (because EMBT developers are id**ts these days) using Records, and magically 
> called it "advanced records". aka Objects - what Turbo Pascal 7 had.

In almost every instance I can think of using so called "managed records" I 
could have achieved the same benefit by simply not allocating the class on the 
heap in the first place. Pascal has gone the way of Java or other high level 
languages that produce tons of garbage by allocating everything on the heap and 
then performing complicated tricks to dispose of all the waste they made.

c++ solves this easily by having a unified class/record model but Pascal would 
need to basically overhaul the entire system to make this work. Until then 
we’re stuck in the middle, using records when we want stack allocation (with a 
broken OOP model) and using Classes when we need OOP features but forced into 
dynamic memory management scenarios.


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to