You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Jens-G <gi...@git.apache.org> on 2017/01/15 14:24:28 UTC

[GitHub] thrift issue #1156: THRIFT-4011 Use slices for Thrift sets

Github user Jens-G commented on the issue:

    https://github.com/apache/thrift/pull/1156
  
    http://thrift.apache.org/docs/types states that (as one would expect) a Thrift map is defined as "A map of **strictly unique keys** to values. Translates to an STL map, Java HashMap, PHP associative array, Python/Ruby dictionary, etc.". 
    
    Given that, I would say it could be one option to error, when the user inserts a duplicate. On the other hand, in that case the better option could be to simply replace the current value. 
    
    But **what should not happen is that serialized data come in with duplicated keys**. That would be clearly an error as it is a violation of the rule above. In that case it might be absolutely ok to return some kind of error.
    
    Re `panic()`, from my understanding of Go that's not the idiomatic way to go, since everything form tha above is an easily recoverable error.
    
    Further reading:
     * https://blog.golang.org/error-handling-and-go
     * https://golang.org/doc/effective_go.html#panic
     * http://stackoverflow.com/questions/28472922/when-to-use-os-exit-and-panic-in-golang



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---