Closed piux2 closed 1 year ago
Golang's team intentionally made it random, starting with Go 1, to make developers not rely on it. See https://go.dev/blog/maps.
Protobuf also specifies that they have fewer guarantees and implements them as slices of structs on the wire.
And on a side note, some web2 CTO friends added linters to prevent their teams from using maps. Even in web2, indeterministic maps were too confusing with flappy unit tests or bugs discovered in production. They told me that maps are generally deficient in performance, not only in go. But please, keep this comment as a hint and not a fact.
My current feeling:
p/avl.Tree
and p/avl.MutTree
to have easy-to-use data structs optimized for chains.[]struct{Key:..., Value:...}
, which is the most common approach for other languages not having map support or looking for more excellent compatibility.
The maptest contract does not return anything when Deposit() is called a second time. The contract seems to have stopped executing before the return but no panic or exception.