新版本的变更 / Delphi 10.4 Sydney

// *** before: ***
// a record was born with whatever bytes happened to be there, so every
// record had an Init method that the caller had to remember to call
type
  TCounter = record
    Value: Integer;
    Name: string;
    procedure Init(const AName: string);
  end;

procedure TCounter.Init(const AName: string);
begin
  Value := 0;
  Name := AName;
end;

var
  C: TCounter;
begin
  C.Init('hits');     // forget this line and Value holds rubbish
end;

// *** in version 10.4: ***
type
  TCounter = record
  public
    Value: Integer;
    Name: string;
    class operator Initialize(out Dest: TCounter);
  end;

class operator TCounter.Initialize(out Dest: TCounter);
begin
  Dest.Value := 0;
  Dest.Name := 'unnamed';
end;

var
  C: TCounter;          // the operator has already run here
begin
  Writeln(C.Value);     // 0, without a single call of your own
  Inc(C.Value);
end;