thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Haggerty <mumb...@gmail.com>
Subject Serialisation of default values
Date Wed, 20 Nov 2013 23:47:29 GMT
Hey all,

Consider a struct like:

struct Dummy {
   1: optional i32 id;
   2: optional i32 age = 10;
}

So, at least with the Python libs, what appear to happen with default
values using TBinaryProtocol is:

 - if I construct Dummy(), it serialises age (as 10)
 - if I construct Dummy(age=None), it doesn't serialise age, but age is set
to 10 when it deserialises

In the interests of reducing the amount of stuff serialised, could this be
changed so that default values are not serialised (i.e. Dummy() is
equivalent to Dummy(age=None)?). The only possible disadvantage is that it
means you get the receiver's default rather than the sender's default if
there's a mismatch - but it's unclear what the desired behaviour would be
in this case anyway.

Thanks,
James.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message