The singleflight package's Group type uses string keys and interface{} values:
https://pkg.go.dev/golang.org/x/sync/singleflight#Group
I've locally forked it to add generics [K comparable, V any] but I'd like to get it upstream instead.
Proposal: add singleflight.TypedGroup[K, V] or singleflight.GenericGroup[K, V] or singleflight.GroupOf[K, V] behind a go1.18 build tag.
Do we have a convention yet on naming new parallel generic types alongside others?
Related: #47657 (for PoolOf, MapOf). (There was also talk of default type parameters so old code could instantiate types and get the old behavior (in this case [string, any]) and new callers could specify types?)
The singleflight package's
Grouptype usesstringkeys andinterface{}values:https://pkg.go.dev/golang.org/x/sync/singleflight#Group
I've locally forked it to add generics
[K comparable, V any]but I'd like to get it upstream instead.Proposal: add
singleflight.TypedGroup[K, V]orsingleflight.GenericGroup[K, V]orsingleflight.GroupOf[K, V]behind ago1.18build tag.Do we have a convention yet on naming new parallel generic types alongside others?
Related: #47657 (for PoolOf, MapOf). (There was also talk of default type parameters so old code could instantiate types and get the old behavior (in this case
[string, any]) and new callers could specify types?)