4 ms·
Go channels are one that's pretty new depending on the language. I came from Python using async for all concurrency, so channels are an odd concept. Passing co
by skrtskrt 4y ago
Go channels are one that's pretty new depending on the language. I came from Python using async for all concurrency, so channels are an odd concept.
Passing context around is an interesting one too
- kubb 4y agoyes, channels and goroutines are a concept that doesn't transfer from C++ or Java :) good job pointing out the exception!
- 62951413 4y agoI believe idioms for dealing with golang channels resemble NIO channels/selectors (e.g. https://docs.oracle.com/javase/8/docs/api/java/nio/channels/package-summary.html https://docs.oracle.com/javase/8/docs/api/java/nio/channels/...). JDK1.4 was already widely used around 2005 ;)
- morelisp 4y agoThe idioms for Go channels as well as NIO channels resemble those of any asynchronous file descriptor handling. Long predating 2005. (And more to the point, still relatively uncommon outside actual I/O in Java.)
- fnord123 4y ago> good job pointing out the exception! No, go doesn't have exceptions. :D To answer the sibling comment (I don't have enough karma to go deeper), Java NIO channels are barely usable. Using them is the quickest way to inject bugs into your code I've seen in Java. Go channels are closer to blocking queues or a selection of concurrent queues depending on whether it's bounded or unbounded, or whether you use select, etc.
- kubb 4y agoit has panic/recover though which is like exceptions :)