On 5 April 2012 16:22, Rush Manbert <[email protected]> wrote:

> It certainly is very permissive on the client side as far as caring whether 
> you really populate a required or "half-way" field, and I would suspect that 
> minimal generated code is part of the reason. Facebook uses this internally, 
> and they are very concerned with performance.
>
> Also, I think this helps with mutation of the struct definitions over time. 
> If I have a server deployed that knows about your CountrySoup definition 
> above, but I talk to it from a client that has this definition:
>
> struct CountrySoup {
>  1: optional i32 npotatoes,
> // nonions has been removed
>  3: required i32 cabbages,
>  4: i32 cupsOfWater,
> }
>
> then the server read routine will never see the Thrift ID value 2 when it 
> receives a CountrySoup message, so in his CountrySoup struct, the 
> __isset.nonions will be false, and since he doesn't have a case for ID value 
> 4, he just ignores the cupsOfWater field. This way clients and servers of 
> different versions can communicate, whether the combination really works or 
> not. It's up to the server implementation to plan for this case and decide 
> what to do if CountrySoup.__isset.nonions is false.


That makes sense. Thanks again, Rush.

Reply via email to