General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Dean Schulze
Kantan Coding
comments
Comments by "Dean Schulze" (@deanschulze3129) on "Master Go Programming With These Concurrency Patterns | Part 2 (in 40 minutes)" video.
Is there a reason why you didn't put the stream <- fn() into the default: in the select? It would be more intuitive there.
1
@kantancoding - Good point about fn() returning a <-chan and potentially blocking. Select will block if no case statement can proceed and there is no default statement. An empty default statement would turn that for-select into a spin loop. It's worth discussing (maybe in a video) when it's better to have for-select block as opposed to having for-select become a spin loop. Would a blocked for-select be more efficient than a spin loop from an empty default? Both would have to continue checking the case statements.
1