Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Map" has no special support #12

Open
kamahen opened this issue Jul 20, 2021 · 1 comment
Open

"Map" has no special support #12

kamahen opened this issue Jul 20, 2021 · 1 comment

Comments

@kamahen
Copy link
Member

kamahen commented Jul 20, 2021

"Map" has no special support. You can do "map" fields, but it's a bit klunky; instead of something like this:

'.MapMessage'{number_ints: _{one:1, two:2}}

you need to do

'.MapMessage'{number_ints:[
    '.MapMessage.NumberIntsEntry'{key:"two",value:2},
    '.MapMessage.NumberIntsEntry'{key:"one",value:1}]}

There are a few reasons for not supporting "map" right now. The biggest one is: what representation should be done for the map?

  • dict
  • library(pairs) - key-value list
  • library(assoc)
  • library(rbtrees)
  • others?

"Dict" only allows atoms and integers for the keys (and the current library(protobufs) code doesn't convert between atoms and string). The other choices have different APIs and performance characteristics. Also, library(pairs) raises the question of ordering and whether it's significant.

For the short term, the best solution is probably a "helper" predicate that translates between the various representations and the protobuf "map". This shouldn't be difficult to write, but I don't feel like doing it until it's actually needed.

@kamahen
Copy link
Member Author

kamahen commented Jul 21, 2021

Partial support added with a4f806c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant