Closed SX91 closed 7 years ago
Ideally we need to separate Signed and Unsigned integers in Object (make two constructors instead of one) and encode Signed as msgpack's negative (value < 0) and unsigned as msgpack positive (value >= 0) ints. This way positives would be easily converted to Int (with checking) and Word; negatives would convert to Int only. It's done this way in many MessagePack implementations (C one, for example).
For example: Try packing 0xFFFFFFFFFFFFFFFF
by data-msgpack and any other (correct) implementation. On Python you'll get b'\xcf\xff\xff\xff\xff\xff\xff\xff\xff'
, on Haskell: "\255"
.
https://github.com/msgpack/msgpack/blob/master/spec.md#types-limitation
This implementation stores it in Int64, which won't adequately represent Unsigned Integers, which are greater than
(2^63) - 1
.