Implement copy-on-write semantics for VarSet, speeding up Environment cloning