vshymanskyy/muon

Handling of duplicate keys in dicts

axman6-da opened this issue · 2 comments

I have several questions relating to dicts:

  • What is the expected handling for dicts where the same key exists multiple times?
  • Should later values replace earlier ones? Is it implementation defined?
  • Is there any expectation of what sort of data structure should represent a dict internally - such as an ordered key-value map, or a hash map?
  • Does/should/can the order of keys matter in an encoding?

Dictionaries with repeated keys should probably be banned ;)
I think Dict should be an ordered dictionary by default (same as List).
It may be worth adding tags for unordered dict and list (which is then treated as a Set).
Unordered Dict then could be safely treated as ordered, if a specific implementation doesn't want to distinguish them.

Here's the initial Dict specification: https://github.com/vshymanskyy/muon/blob/master/docs/README.md#dictionary
LMK your thoughts or if more details are needed.