dimforge / dimforge/nalgebra

Changed serialization breaks things

Open
#1,323 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

In 0.32.3 serialization was changed, as per the changelog:
> Statically sized matrices are now serialized as tuples to match how serde serialized plain arrays.

This has the unfortunate effect of making it impossible to deserialize data serialized by previous versions of Nalgebra using version 0.32.3 (and vice versa). In my case, all the assets of my game are serialized using serde+bincode. Since all asset types contain Nalgebra types, the asset files can no longer be deserialized after upgrading Nalgebra.

The solution was pretty convoluted and brittle. I had to create a converter program that:

- Reads (deserializes) assets using Nalgebra 0.32.2
- Re-implements all the asset types verbatim, but using Nalgebra 0.32.3 types
- `mem::transmute`s all the assets from the old types to the new
- Writes (serializes) new assets back to disk

Maybe there is a smarter way, but I could not come up with anything. Anyway, to avoid similar problems in the future, I would suggest

- Only breaking serialization/deserialization backward compatibility when absolutely necessary
- Flagging the changes as breaking, preferably using SemVer

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.