<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 1/24/25 3:21 AM, Hairy Pixels via
      fpc-pascal wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGsUGt=K+d3b=Veve4mOk7G_Ztr2SfNsJTLu6v7PzGk+wCTnDw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Jan 24, 2025 at 2:10:53 AM,
          Santi via fpc-pascal <<a
            href="mailto:fpc-pascal@lists.freepascal.org"
            moz-do-not-send="true" class="moz-txt-link-freetext">fpc-pascal@lists.freepascal.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"
          type="cite"> procedure foo()<br>
          var<br>
           s1: TStringList;<br>
           s2: TStringList;<br>
           s3: TStringList;<br>
          begin<br>
           s1:=TStringList.create;<br>
           try<br>
             s2:=TStringList.create;<br>
             try<br>
               s3:=TStringList.create;<br>
               try  <br>
                 doWhatever(s1,s2,s3)<br>
               finally<br>
                 s3.free;<br>
               end;<br>
             finally<br>
               s2.free;<br>
             end;<br>
           finally<br>
            s1.free;<br>
           end <br>
          end; </blockquote>
      </div>
      <br>
      <div dir="ltr">Honestly this is the worst memory management
        strategy I've seen in any language. It's more keywords than
        code! It was Delphi’s idea right? If you’re making some UI app
        in 2025 a garbage collector or full ARC is perfectly fine so I
        don’t see how they get away with selling this.</div>
    </blockquote>
    <p>Maybe because there's a much better way to write it:</p>
    <p>procedure foo();<br>
      var<br>
        s1: TStringList = nil;<br>
        s2: TStringList = nil;<br>
        s3: TStringList = nil;<br>
      begin<br>
        try<br>
          s1:=TStringList.create;<br>
          s2:=TStringList.create;<br>
          s3:=TStringList.create;<br>
          doWhatever(s1,s2,s3);<br>
        finally<br>
          FreeAndNil(s3);<br>
          FreeAndNil(s2);<br>
          FreeAndNil(s1);<br>
        end;<br>
      end;</p>
    <p>Best regards,<br>
    </p>
    <p>Nikolay<br>
    </p>
  </body>
</html>