swap
void swap(var self, var obj);
Swap the object self for the object obj.
Usage
var x = $S("Hello");
var y = $S("World");
show(x); /* Hello */
show(y); /* World */
swap(x, y);
show(x); /* World */
show(y); /* Hello */
Swapable
The Swap class can be used to override the behaviour of swapping two objects. By default the Swap class simply swaps the memory of the two objects passed in as parameters making use of the Size class. In almost all cases this default behaviour should be fine, even if the objects have custom assignment functions.
Swapping can be used internally by various collections and algorithms.
struct Swap {
  void (*swap)(var, var);
};