Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Curious, how is a map generic?


If you declare a map[string]int, Go will guarantee that keys are always strings and values are always ints, and it's a compile-time error to pass it to someone expecting a map[string]float64. Without generics, the only way to do that is to generate and compile a MapStringInt struct and a MapStringFloat64 struct and a...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: