Re:Learning a new language, or how I gained familiarity with Go
by kubb on Wednesday August 17, 2022 @01:38PM
(#32499402)
yes, channels and goroutines are a concept that doesn't transfer from C++ or Java :) good job pointing out the exception!
[ Parent
| on HN ]
Re:Learning a new language, or how I gained familiarity with Go
by fnord123 on Wednesday August 17, 2022 @03:57PM
(#32500987)
> 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.
Re:Learning a new language, or how I gained familiarity with Go
by kubb on Thursday August 18, 2022 @05:11AM
(#32507097)
it has panic/recover though which is like exceptions :)
Re:Learning a new language, or how I gained familiarity with Go
by 62951413 on Wednesday August 17, 2022 @03:55PM
(#32500954)
I believe idioms for dealing with golang channels resemble NIO channels/selectors (e.g. https://docs.oracle.com/javase/8/docs/api/java/nio/channels/...). JDK1.4 was already widely used around 2005 ;)
Re:Learning a new language, or how I gained familiarity with Go
by morelisp on Wednesday August 17, 2022 @04:32PM
(#32501345)
The 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.)