<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">Am 08.03.2018 12:51 schrieb "Ryan Joseph" <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>>:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"><br>
<br>
> On Mar 8, 2018, at 5:42 PM, Sven Barth via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.<wbr>org</a>> wrote:<br>
><br>
> 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.<br>
><br>
<br>
</div>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.<br>
<br>
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.</blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">This is not an oversight, but an explicit design decision of the language.</div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"></div></div>