Dynamically changing code in a safe way