4 ms·
A question on generics from the docs if the declaration is func Keys(type K, V)(m map[K]V) []K why do we need to call it like keys := Keys(int, string)(map[
by sukunrt 8y ago
A question on generics from the docs
if the declaration is
func Keys(type K, V)(m map[K]V) []K
why do we need to call it like
keys := Keys(int, string)(map[int]string{1:"one", 2: "two"})
can't the types int and string be inferred from
Keys(map[int]string{1:"one", 2:"two"})