You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MsgPack, we currently serialize Map<K,V> as an object by default, and as an extension type when it should be treated as a Generic Map. How to treat it depends on context. This works in JavaScript (and maybe Python). In statically typed languages like Rust, Kotlin, and Swift, solutions are more complicated.
In Kotlin and Swift (and originally in Rust), users must wrap their Map in a GenericMap class so it can be serialized as an extension type.
In Rust, a custom implementation of the serde msgpack package was written to avoid this sort of behavior. (This can also be done in Kotlin in the future, but is unnecessary if this idea is executed.)
However, it is possible to simply always serialize Map without using extension types.
When we serialize an object to MsgPack, we are actually serializing the object using MsgPack’s Map format. This works because an object is a set of key-value pairs. Because we were doing that, we decided to treat actual maps as a MsgPack “extension type”.
If we were to serialize both Map and Object types using the MsgPack Map format, we could still distinguish between them. Wraps would still know how to serialize and deserialize each type because the wrap bindings are generated from the schema.
This change would improve the UX for app and plugin developers using statically typed languages like Kotlin, Swift, possibly Rust, and any others we support in the future.
The text was updated successfully, but these errors were encountered:
https://www.notion.so/polywrap/934502fd65c94d85a80358fa5fd785f2?v=fc823028892c456ca5a228e422474d36&p=32524b44a90c40fb984d723757d478ab&pm=s
The text was updated successfully, but these errors were encountered: