Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The alternatives:

Using http://golang.org/pkg/reflect/#Select to build what you need;

Or building something specific to your use case without the above, which seems likely to be... goofy and unmanageable. Creating objects that create new channels to do `select`s over some fixed number of cases and composing those.

Do you have any experience using `reflect.Select`? While not exactly ergonomic, it seemed a... pretty okay tradeoff, inconvenience for power, and at the very least more power for approximately the same amount of pain as the rest of the `reflect` package.



One problem with using "reflect" this way, apart from the fact that it's (a) counter to idiom and (b) takes your code in a direction of being counter to idiom in general, is that "reflect" is pretty slow.

You can do it, but since the only reason to do it is to avoid spawning goroutines, I'm not sure why you'd bother.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: