The link between capacity and consequences is very clear when you're
speaking of the canonical implementation of a hash table but a quick
look at the code made me think that Go's map is more complex than that.
What kind of map is it ?
> Ok. And why cann't be got the initial capacity given in the map? (If
> any)
> The function cap() is not valid in maps.
It's hard to see why that would be an interesting number. The capacity
is an important number for a slice. But we don't want to constrain the
implementation of the map datatype by defining exactly what the capacity
of a map is. And if we don't define the capacity, then the cap function
is not useful.
It might be better to think of the optional second argument to make when
making a map not as the capacity, but as a hint as to the number of
elements expected to go into the map. And you can use len to get the
number of elements that are actually in the map.
Ian