Изменения в новых версиях / Delphi XE3

// *** before: ***
// a helper could only be attached to a class or to a record, never to
// Integer or string, so the shortcuts were plain functions
function IsEven(const Value: Integer): Boolean;
begin
  Result := Value mod 2 = 0;
end;

begin
  Writeln(IsEven(42));
  Writeln(IntToStr(42));
end;

// *** in version XE3: ***
type
  // a helper for an intrinsic type: the method belongs to the value
  TIntegerHelper = record helper for Integer
    function IsEven: Boolean;
    function Times(const Factor: Integer): Integer;
  end;

function TIntegerHelper.IsEvenBoolean;
begin
  Result := Self mod 2 = 0;
end;

function TIntegerHelper.Times(const Factor: Integer): Integer;
begin
  Result := Self * Factor;
end;

var
  N: Integer;
begin
  N := 42;
  Writeln(N.IsEven);        // TRUE
  Writeln(N.Times(2));      // 84
end;

// one helper per type is in scope at a time: a later one hides the
// earlier one instead of adding to it