On 04/27/2010 06:54 PM, tama wrote:
On Tue, 27 Apr 2010 21:27:35 +0900, Lars T. Kyllingstad
<[email protected]> wrote:
Phobos should definitely have a serialisation module, and this seems
to me like a good candidate. I haven't tried the code myself, but it
looks very clean and the examples are nice.
Thanks!
I consider it a huge plus that it uses an existing format that already
has APIs for a bunch of programming languages.
I agree. At first, I checked several serialization libraries.
As a result, I select MessagePack with all things considered.
Other libraries and Specs seem to be large and complex.
Two questions:
The packer can write to an arbitrary ubyte output range, but it seems
the unpacker is limited to ubyte[] arrays. Would it be possible to
unpack from an arbitrary input range?
No. Unpacker is possible to do so if D has integrated stream.
For your information, Other implementation(e.g. Java) uses InputStream.
It doesn't seem to support the real type. It this a limitation of the
MessagePack format or just an oversight? Even if the format doesn't
directly support 80-bit floats, it should be possible to wrap them
somehow.
Good point. MessagePack doesn't define real type(80-bit float) because
some languages don't have real. But MessagePack has free format space,
so some implementation can support language-specific format.
real has environment-dependent problem. This problem causes loss of
precision.
Unpacker can't be responsible for this problem. OK?
I will try to implement real support.
For systems where real is 64 bits it may be possible to use an 80-bit
std.numeric.CustomFloat as an intermediate step between the stored data
and the 64-bit type.
-Lars