additional map keys

5,024 views
Skip to first unread message

Arpit Baldeva

unread,
Nov 21, 2016, 12:41:49 PM11/21/16
to Protocol Buffers
Hi,

Are there any plans to support

1. Enums as keys in a map
2. Case-insensitive keys in a map 

Thanks
Arpit

Feng Xiao

unread,
Nov 21, 2016, 2:39:28 PM11/21/16
to Arpit Baldeva, Protocol Buffers
On Mon, Nov 21, 2016 at 9:41 AM, Arpit Baldeva <abal...@gmail.com> wrote:
Hi,

Are there any plans to support

1. Enums as keys in a map
This is disallowed because it doesn't play well with proto3 open enum semantics. For example, in Java, if you have a Map<Enum, Value>, the key can only be one of the defined values. If you happen to receive an enum key value from a remote client/server that's not in the defined value set, it can't be put in the Map<Enum, Value>. This limitation forces us to either drop map entires with unknown enum keys (which is against proto3 open enum semantics), or disallow enum as map keys all together.
 
2. Case-insensitive keys in a map 
This can only happen if the map structure in every protobuf-supported language supports case-insensitive keys. I doubt that's the case though.
 

Thanks
Arpit

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages