News for hackers. Stuff that matters.
Re:Goroutines and APIs by kstenerud on Monday November 18, 2019 @08:09PM (#21569883)
"threads" (goroutines) and channels are the new gotos. They tend to make a codebase more difficult to reason about. The more you add, the more you tend to get spooky action at a distance.
Re:Goroutines and APIs by zerotolerance on Monday November 18, 2019 @09:29PM (#21570223)
These are hardly new concepts, nor are there any more appropriate mechanisms for modeling dependencies between multiple concurrent actors. If anything, the traditional shared memory nightmare has proven to be the goto in the room.
Re:Goroutines and APIs by lostcolony on Monday November 18, 2019 @11:13PM (#21570611)
Funny you should say actors. While some people will equate the two, I find Erlang actors easier to reason about than go channels. Though that has everything to do with monitors and links, to tie dependent goroutines/processes together.
Re:Goroutines and APIs by sidlls on Monday November 18, 2019 @11:40PM (#21570689)
And, like the goto statement, surely there will be scolds warning everyone not to use these anywhere instead of treating them like any other language feature to be used with care and as sparingly as possible.
Re:Goroutines and APIs by Thorrez on Monday November 18, 2019 @10:27PM (#21570412)
Unfortunately Moore's law is no longer expressing itself in terms of single threaded performance. So the only way to take advantage of the faster CPUs that are being released is to write multi-threaded code.

Many alternatives to channels (mutexes, atomics, semaphores, condition variables) have just as much if not more chance of turning the codebase into a mess. But yes I agree that if performance-wise you can handle being single-threaded, then do that, because it's much simpler.