5 ms·
Whats wrong with "demand-creating" channels? The Go stdlib does it within their network library https://golang.org/src/net/singleflight.go#L67 https://golang.or
by levigross 11y ago
Whats wrong with "demand-creating" channels? The Go stdlib does it within their network library https://golang.org/src/net/singleflight.go#L67 https://golang.org/src/net/singleflight.go#L67
- tptacek 11y agoBecause you can't select on an arbitrary collection of channels. It might make sense for a library to return a new channel for something you do once, or once per goroutine. It doesn't make sense to use returned channels as a basis for async dispatch.