thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Reiss <dre...@facebook.com>
Subject Re: default, required, optional
Date Fri, 31 Oct 2008 20:23:40 GMT
The default replicates the behavior that existed before required and
optional were added.  These fields are always set when serializing,
regardless of the value of __isset.  This means that programmers do not
have to manually maintain __isset.  (Actually, the fields are not
serialized if they are null in languages that allow it.)  However, when
deserializing, no error is thrown if a default field is not present (for
example, if it was sent by an older client or server, or if it was
null).

--David

Bryan Duxbury wrote:
> Can someone help me understand the difference between required,
> default, and optional field modifiers? Required seems to make sense.
> Optional seems to make sense. However, the fact that there's a third
> state is quite ambiguous.
> 
> It seems like the field modifiers should be binary - required or
> optional. Leaving the modifier off should just be a shorthand for
> optional.
> 
> -Bryan

Mime
View raw message