MsgPack.jl
MsgPack.jl copied to clipboard
Irrational{S} support missing
Serialization of the type Irrational{S} is missing. For example:
julia> pack(pi)
ERROR: no non-`AnyType` MsgPack mapping found for Irrational{:π}; please overload `msgpack_type` for this type.
I think most users are not aware that pi
is not simply the floating point representation of pi, therefore expecting that if you can pack a float, you can also pack pi
.
I would propose to add the following to the package:
MsgPack.msgpack_type(::Type{Irrational{S}}) where S = MsgPack.FloatType()
MsgPack.to_msgpack(::MsgPack.FloatType, x::Irrational{S}) where S = float(x)
I could prepare a PR, if you find this useful.