[
https://issues.apache.org/jira/browse/THRIFT-5040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16985092#comment-16985092
]
Jens Geyer commented on THRIFT-5040:
------------------------------------
It breaks the behaviour between C# and Java that must be documented .... well,
there are languages on this earth who don't even have nullables. What kind of
weird argument is that? In that regard we are more along the original spec (the
Thrift Whitepaper), hence why not claim that Java's nullables should be
documented, as they are aginst the spec?.
Just to have another eaxmple: Since some Go inventor decided that Go should not
have exceptions, so shall we all no longer use them? Clearly no.
In fact, Thrift represents a variete of languages, each one with its own
specifics, pros and cons. Each language binding should strive to do the best
possible to uphold the core values of Thrft, while adhering to the set of
standards defined as much as possible. On the other hand, the spec is not
carved in stone, the world is moving on and we shall put the means to use that
we are given for a particular language, there's no doubt about that. However,
it makes not much sense to demand the exact same behaviour in all details
across 20+ languages at all cost.
Hence, if you feel that bringing the Nullables in again is a great addition,
then, well so be it. I just would like to have it less clumsy than we had it
implemented before. And it absolutely should be an option again - you don't
want to make this the default, believe me.
Last not leást, I would love to have less of these "drama" tickets. I leave it
at that.
> Optional fields for value types are not Nullable in C# (netstd)
> ---------------------------------------------------------------
>
> Key: THRIFT-5040
> URL: https://issues.apache.org/jira/browse/THRIFT-5040
> Project: Thrift
> Issue Type: Wish
> Components: netstd - Compiler
> Affects Versions: 0.13.0
> Reporter: Konstantin
> Priority: Major
>
> Optional fields for value types are not Nullable in C# (netstd)
> for example
> {code:java}
> struct Test {
> 1: required i64 id,
> 2: optional bool some_flag
> }
> {code}
> will generate class
> {code:java}
> public partial class Test : TBase{
> private bool _some_flag;
> public long Id { get; set; }
> public bool Some_flag { get { return _some_flag; } set
> { __isset.some_flag = true; this._some_flag = value; } }
> {code}
> that makes the some_flag to be false even if it was not set on the sending
> party.
>
> The optional value types should be generated as Nullable<T>:
> {code:java}
> private bool? _some_flag;
> {code}
>
> This is especially harmful with other value types like int, enums, etc...
--
This message was sent by Atlassian Jira
(v8.3.4#803005)