This is extremely useful for things like writing save games while the game is in development. Often times we have long-lived serialized data, which corresponds to an object type that evolves over time in ways that are not backwards-compatible. In these situations, it's necessary to write a custom process of migrating the older data to the newer format.
There are two aspects of this:
- Add a type annotation to specify a current "version" number for a serialized object.
- Add a process to register a custom version migration function. This function would convert the data in an older format into a newer format. The registration process should allow for complex version matching predicates such that it's easy to define migrations like: "any version less than 3 to version 7", "any unknown version to version 9", "version 8 to version 9" etc...
This is extremely useful for things like writing save games while the game is in development. Often times we have long-lived serialized data, which corresponds to an object type that evolves over time in ways that are not backwards-compatible. In these situations, it's necessary to write a custom process of migrating the older data to the newer format.
There are two aspects of this: