generic function replace<T>(var X: T; NewValue: T):T;
begin
Result := X;
X := NewValue;
end;
begin
x := someoldvalue;
y := specialize replace<TSomeType>(x, somenewvalue);
end.
generic function replace<T>(var X: T; NewValue: T):T;
begin
Result := X;
X := NewValue;
end;
begin
x := someoldvalue;
y := specialize replace<TSomeType>(x, somenewvalue);
end.