zlacker

[return to "Go(lang): Robust generic functions on slices"]
1. gslall+Ng3[view] [source] 2024-02-24 09:47:08
>>signa1+(OP)
> func Index[S ~[]E, E comparable](s S, v E) int {

After seeing this signature, I think that Go is giving up on it's simpleness principle.

◧◩
2. quickt+wj3[view] [source] 2024-02-24 10:30:40
>>gslall+Ng3
what does the ~ do here anyway?
◧◩◪
3. onefiv+qk3[view] [source] 2024-02-24 10:44:03
>>quickt+wj3
type Something []string

ensure that the underlying type is a slice

[go to top]