You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't understand why the thrift type set<T> is mapped to the Go type map[T]interface{}.
I think that map[T]struct{} is more appropriate -- this map uses 0 bytes for the value and is the most space-efficient representation of a set using Go maps.
An alternative that's a little more convenient is map[T]bool.
The text was updated successfully, but these errors were encountered:
Changed it to struct{} in latest master. The reason not bool is because the reflection encoder checks for map[T]struct{} to signify a set. It won't occur in normal use unlike map[T]bool which could and thus requires tagging the field as a set.
The encoding/decoder now support map[T]bool tagged as a set and only including keys where the value is true. This could change to be the default in the future once the code generator is creating static code for the marshall/unmarshall. For now though they rely on the reflection api.
I don't understand why the thrift type
set<T>
is mapped to the Go typemap[T]interface{}
.I think that
map[T]struct{}
is more appropriate -- this map uses 0 bytes for the value and is the most space-efficient representation of a set using Go maps.An alternative that's a little more convenient is
map[T]bool
.The text was updated successfully, but these errors were encountered: