title: Why is this code working and how is Delphi instantiating a class in this case?
body: <p>I'm doing the Delphi track at exercism, and following how Delphi generates code for a form, answered one of the basic questions like this:</p>
  <pre><code>unit uLeap;
  
  interface
  
  type
    TSYear = class
      public
        { public declarations here }
        function isLeap(y: integer): boolean;
    end;
  
  var
  TYear: TSYear;
  
  implementation
  
  function TSYear.isLeap(y: integer): boolean;
  begin
    result := ((y mod 4) = 0) and (((y mod 400) = 0) or ((y mod 100) &lt;&gt; 0));
  end;
  
  end.
  </code></pre>
  <p>the code compiles without a single complaint, I can run it step by step, and the &quot;isLeap&quot; function is called from another unit several times this way:</p>
  <pre><code>procedure YearTest.year_divisible_by_4_not_divisible_by_100_leap_year;
  begin
    assert.IsTrue(TYear.IsLeap(1996), 'Expected ''true'', 1996 is a leap year.');
  end;
  ...
  </code></pre>
  <p>I've never explicitly created the instance of the class, but it seems as if Delphi is doing it somewhere, maybe when declaring TYear? Is that a valid way?</p>
  <p>Despite passing all the tests the code was rejected because it isn't done the conventional way. I'll surely end up doing it differently to have it accepted, but, besides the bad naming, why is this working? Would this code cause problems somewhere I can't see in this simple example?</p>