Logo

Programming-Idioms

  • C++
  • Go
old, x = x, new
utility
std::exchange(x, v);
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.

New implementation...
< >
pi