3 ms·
It's because appending to a slice returns another slice, whereas assigning a key to a map doesn't return another map. That means that there's no sensible way to
by foldr 4y ago
It's because appending to a slice returns another slice, whereas assigning a key to a map doesn't return another map. That means that there's no sensible way to assign a key of a nil map. You could make adding a key to a map work like appending a value to a slice, or you could add an extra level of indirection to the underlying map type (make it a pointer to a struct instead of a struct). Neither of those alternatives seems particularly attractive, though.