title: Why are Delphi objects assigned even after calling .Free?
body: <p>In Delphi, why does the Assigned() function still return True after I call the destructor?</p>
  
  <p>The below example code will write "sl is still assigned" to the console.</p>
  
  <p>However, I can call FreeAndNil(sl); and it won't be assigned.</p>
  
  <p>I've been programming in Delphi for a while, but this never made sense to me.</p>
  
  <p>Can someone explain?</p>
  
  <pre><code>program Project1;
  {$APPTYPE CONSOLE}
  uses SysUtils, Classes;
  
  var
    sl : TStringList;
  
  begin
    sl := TStringList.Create;
    sl.Free;
    if Assigned(sl) then
      WriteLn('sl is still assigned')
    else
      WriteLn('sl is not assigned');
  end.
  </code></pre>
  
  <p>I tried comparing the VCL operations... FreeAndNil is short and sweet and makes sense:</p>
  
  <pre><code>procedure FreeAndNil(var Obj);
  var
    P: TObject;
  begin
    P := TObject(Obj);
    TObject(Obj) := nil;  // clear the reference before destroying the object
    P.Free;
  end;
  </code></pre>
  
  <p>But TObject.Free is in mysterious assembler, which I don't understand:</p>
  
  <pre><code>procedure TObject.Free;
  asm
          TEST    EAX,EAX
          JE      @@exit
          MOV     ECX,[EAX]
          MOV     DL,1
          CALL    dword ptr [ECX].vmtDestroy
  @@exit:
  end;
  </code></pre>