If all of the changes happen in memory, and persisting the structure is when the new version is created, then your functions could all just operate only on the in-memory structure, and you could ensure that you only get an in-memory structure using the `with` syntax.

It's the same sort of thing you've talked about in other contexts: separating persistence from modification.