I've only just recently learned about Google's programming language, Go. I've been intrigued by its offered support for concurrency, and set out to learn more about it. However, I went looking to see how Go implemented a particular feature of concurrency, and so far I haven't seen any evidence at all that this feature is there at all.
Here's a hypothetical situation: suppose we are programming a function to determine the Foo value of a particular input. For any given input, the Foo value is found either in domain A, or domain B (not in both). The techniques of searching in these domains are quite different, but they share the property that successful searches tend to return quickly, while unsuccessful searches must go through the entire dataset to be exhaustive and therefore take a long time.
Now, in other languages that employ concurrency (such as Cilk) one could program the function Foosearch so that it spawned an Asearch function and a Bsearch function. These functions would run concurrently, and whenever either of them came up with an answer, that answer would be reported to the calling function Foosearch, which would terminate any functions it had spawned that had not returned.
With Go's goroutines, however, it looks like you can only connect two routines with a channel - so you couldn't set up a channel to which either Asearch or Bsearch could send, depending on which found an answer first, and have Foosearch read from it. It also looks like you can't read from a channel without blocking on it - so you couldn't have Foosearch start Asearch and Bsearch and set up channels from both, then run in a loop checking to see if one or the other has produced an answer.
Is my understanding of the limits of Go's concurrency correct? Is there another way to achieve the given result?