Open phqb opened 2 months ago
This looks like a quite unobtrusive change. I prefer that to https://github.com/tinylib/msgp/pull/331 which forces an interface that can be difficult to satisfy for external types.
Ultimately I think "msgp" should allow for all built-in types (except maps) to be keys - perhaps as a commandline opt-in.
I'm using
tinylib/msgp
to add marshaling/unmarshaling to existing structs. This library works very well in my usecase. I appreciatetinylib/msgp
's maintainers a lot.My structs have a lot of
map
whose keys are notstring
and MessagePack requires map key to be string. I can replace all these map keys withstring
but doing this makes my structs lost some of their readability and I have to do some refactoring.For an example, I have to change the following struct:
to
to maintain readability.
tinylib/msgp
already hasshim
directive that allows any type to be (un)marshaled as another type. I use this feature a lot to avoid refactoring my structs. It will be nice thatshim
directive also transform non-string map key to string so the following code:will be generated as