You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Diwaker Gupta (JIRA)" <ji...@apache.org> on 2011/03/10 01:50:00 UTC

[jira] Commented: (THRIFT-627) should c++ have setters for optional fields?

    [ https://issues.apache.org/jira/browse/THRIFT-627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13004904#comment-13004904 ] 

Diwaker Gupta commented on THRIFT-627:
--------------------------------------

I've cleaned up the patch and incorporated David's comments. It can be reviewed here:
https://github.com/maginatics/thrift/commit/0b81de84b581c99daeac78526890d4c439611722

Once the patch is approved, I can attach it here in JIRA (I find attached patches extremely hard to review).

> should c++ have setters for optional fields?
> --------------------------------------------
>
>                 Key: THRIFT-627
>                 URL: https://issues.apache.org/jira/browse/THRIFT-627
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Compiler
>         Environment: c++
>            Reporter: Ben Taitelbaum
>            Assignee: David Reiss
>         Attachments: thrift-627_0.5.x.patch, thrift-627_trunk.patch
>
>
> It seems non-intuitive to me to have to set __isset.someField = true after setting an optional field someField on a struct. Would it make sense to have a set_someField method that would both set the field and modify __isset?
> One of the cases for this is for when a field goes from being required to being optional, and it's easy to forget to set __isset in the code.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira