- point out in gotchas does not support enums
- And on derserialization, better document how memory is managed. Suppose a type T is serialized. Further suppose T contains a slice of type []Foo, and that T has methods to add and remove items from Foo. Then during deserialization a slice of []Foo would have to be allocated separately so T's mutator methods can add/remove items to []Foo in memory for it alone
This latter issue is a problem with Zig's parseFromSlice JSON deserializer. Although it's darn flexible handling enums, the object is exists inside a (essentially) single allocation. Therefore, add/removing items from []Foo is no longer possible after deserialization. In short, a single allocation for T is fine provided T is never mutated after deserialization otherwise a more sophisticated deserialization method is need to allocate separate memory per field as needed.
This latter issue is a problem with Zig's parseFromSlice JSON deserializer. Although it's darn flexible handling enums, the object is exists inside a (essentially) single allocation. Therefore, add/removing items from []Foo is no longer possible after deserialization. In short, a single allocation for T is fine provided T is never mutated after deserialization otherwise a more sophisticated deserialization method is need to allocate separate memory per field as needed.