Using metatables to preserve primitive state from mutation