Request for review - std.serialization (orange)

Matt Soucy msoucy at csh.rit.edu
Mon Apr 1 14:11:57 PDT 2013


On 04/01/2013 04:54 PM, Kagamin wrote:
> On Monday, 1 April 2013 at 19:37:12 UTC, Matt Soucy wrote:
>> It's not really strange, because of how it actually does the
>> serialization. A message is recorded as length+serialized members.
>> Members can happen in any order. Packed repeated messages would look
>> like...what? How do you know when one message ends and another begins?
>> If you try and denote it, you'd just end up with what you already have.
>
> Well, messages can be just repeated, not packed. Packing is for really
> small elements, I guess, - namely numbers.
>

And therefore, it supports arrays just fine (as repeated fields). Yes. 
That last sentence was poorly-worded, and should have said "you'd just 
end up with the un'packed' data with an extra header."

>> In your example, you'd want to send each individual result as a
>> distinct message, so they could be read one at a time. You wouldn't
>> want to pack, as packing is for sending a whole data set at once.
>
> So you suggest to send 1 message per TCP packet?

Unfortunately, I'm not particularly knowledgeable about networking, but 
that's not quite what I meant. I meant that the use case itself would 
result in sending individual Result messages one at a time, since 
packing (even if it were valid) wouldn't be useful and would require 
getting all of the Results at once. You would just leave off the 
"packed" attribute.


More information about the Digitalmars-d mailing list