General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Dean Schulze
Kantan Coding
comments
Comments by "Dean Schulze" (@deanschulze3129) on "Kantan Coding" channel.
Previous
1
Next
...
All
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
You've eliminated access to shared state. That's easy to do with arrays. What other data structures will this pattern work with?
1
Previous
1
Next
...
All