[fpc-pascal] Managed record questions
ryan at thealchemistguild.com
Thu Mar 15 15:12:22 CET 2018
> On Mar 9, 2018, at 11:19 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> Because this way the user is aware that they are something special and are not supposed to be called manually.
That makes sense.
Why can’t the compiler use a similar method to call a function when a stack based construct like a record or object goes in/out of scope? We have the management operators now (which are more complicated) and reference counted interfaces (I never used those before they sound like the current standard for “ARC” in FPC but nothing which is a low-level compiler feature.
After doing some C++ work this week it appears they simply call the constructor/destructor for stack based structs/classes when they go in/out of scope and on class member variables when their parent class goes in/out of scope. It’s very simple but cleans up so many scenarios that exist in FPC so I’m curious why we never got this feature.
More information about the fpc-pascal