Closed kaey closed 10 months ago
Just a nit pick:
Ordered hash maps would complicate implementation for some languages, like go(map) or python(dict).
Python 3 dict
is ordered. For Go (as well as any other at least a bit widespread language) there is always an ordered map module - see e.g. https://github.com/iancoleman/orderedmap .
Maps represent a sequence of field-value items, basically what we could call a dictionary data structure, or in other terms, an hash.
The theoretical datastructure 'hash' and 'dictionary' are unordered - of course some implementations do have orderings fall-out as a side-effect (insert order, usually).
I think there should be no guarantee of order made by RESP3, as this would require Redis or any other implementer of RESP3 to always return the same ordering for a map and make implementing a client tricky in a language where the 'logical' native map type to return is not ordered (for example, Go maps, Python 2 dicts) - you would either depend on a non-standard library that provides an ordered map, or ditch the ordering and return your native unordered type.
Spec suggests encoding json as an example and json is unordered, however it doesn't explicitly states this.
Ordered hash maps would complicate implementation for some languages, like go(map) or python(dict).