> On Mar 8, 2018, at 5:42 PM, Sven Barth via fpc-pascal > <fpc-pascal@lists.freepascal.org> wrote: > > You are supposed to use try...finally for this. The finally-block is always > executed when the try-block is left no matter if it's by reaching the end, > calling exit or by an exception. >
But my greater point is why are we doing any of this at all? Try blocks, ARC, management operators, garbage collectors, all because we can’t allocate on the stack. I understand there are objects (which are missing how many features that classes have?) and records which lack a fundamental OOP feature which is inheritance. The stack knows when the scope is terminated so it could easily free these classes for us and all too often we only need an object for the duration of a single function so allocating dynamic memory is just wasteful. I know there’s not much we can do about it now but it’s a really unfortunate oversight. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal