Re:Go package: fanout – make writing parallel code even easier
by sunfmin on Saturday January 10, 2015 @03:54AM
(#8866342)
Yes, I often find myself lost in this trivial channels + goroutines + WaitGroup combination. For my self I'd prefer cast interface{}, :-)
[ Parent
| on HN ]
Re:Go package: fanout – make writing parallel code even easier
by chimeracoder on Saturday January 10, 2015 @10:40AM
(#8866963)
interface{} is different from []interface{}.
You can do a type assertion (not cast - these are different concepts) from interface{} to another type. You cannot do a type assertion on []interface{}; you have to iterate over each element and assert individually.
I agree with GP - the built-in primitives for synchronization, along with sync from the stdlib, are much cleaner once you know how to use them, and they're more idiomatic.