←back to thread

159 points mpweiher | 2 comments | | HN request time: 0s | source
Show context
anacrolix ◴[] No.43672435[source]
I've been using Go since 2011. One year less than the author. Channels are bad. No prioritization. No combining with other synchronisation primitives without extra goroutines. In Go, no way to select on a variable number of channels (without more goroutines). The poor type system doesn't let you improve abstractions. Basically anywhere I see a channel in most people's code particular in the public interface, I know it's going to be buggy. And I've seen so many bugs. Lots of abandoned projects are because they started with channels and never dug themselves out.

The lure to use channels is too strong for new users.

The nil and various strange shapes of channel methods aren't really a problem they're just hard for newbs.

Channels in Go should really only be used for signalling, and only if you intend to use a select. They can also act as reducers, fan out in certain cases. Very often in those cases you have a very specific buffer size, and you're still only using them to avoid adding extra goroutines and reverting to pure signalling.

replies(4): >>43672565 #>>43673084 #>>43673101 #>>43675349 #
hajile ◴[] No.43673101[source]
This is almost completely down to Go's type terrible system and is more proof that Google should have improved SML/CML (StandardML/ConcurrentML) implementations/libraries rather than create a new language. They'd have a simpler and more powerful language without all the weirdness they've added on (eg, generics being elegant and simple rather than a tacked-on abomination of syntax that Go has).
replies(2): >>43673319 #>>43678543 #
hesdeadjim ◴[] No.43673319[source]
Go user for ten years and I don’t know what happened, but this year I hit some internal threshold with the garbage type system, tedious data structures, and incessant error checking being 38% of the LoC. I’m hesitant to even admit what language I’m considering a full pivot to.
replies(5): >>43673766 #>>43673782 #>>43674588 #>>43675348 #>>43677473 #
likeabbas ◴[] No.43673782[source]
Java 21 is pretty damn nice, 25 will be even nicer.

For your own application code, you don't have to use exceptions you can write custom Result objects and force callers to pattern match on the types (and you can always wrap library/std exceptions in that result type).

Structured Concurrency looks like a banger of a feature - it's what CompletableFuture should've been.

VirtualThreads still needs a few more years for most production cases imo, but once it's there, I truly don't see a point to choose Go over Java for backend web services.

replies(2): >>43675219 #>>43675901 #
fpoling ◴[] No.43675219[source]
And Java has non-trivial advantage over Go of being arch-independent. So one can just run and debug on Mac Arm the same deployment artifact that runs on x86 server.

Plus these days Java GC has addressed most of the problems that plagued Java on backend for years. The memory usage is still higher than with Go simply because more dynamic allocations happens due to the nature of the language, but GC pauses are no longer a significant problem. And if they do, switching to Go would not help. One needs non-GC language then.

replies(1): >>43675802 #
synergy20 ◴[] No.43675802[source]
go can ship as a static exe, can't be simpler to deploy, until java has this built-in, I'll stick with go for my cross platform choice
replies(1): >>43676952 #
1. likeabbas ◴[] No.43676952[source]
If you're building tools that need to be deployed to machines, Go/Rust with their static binaries make a lot of sense. But for backend web services, it's hard not to go with Java imo.

fwiw - My favorite language is Rust, but Async Rust has ruined it for me.

replies(1): >>43691368 #
2. pdimitar ◴[] No.43691368[source]
Yeah, async Rust is needlessly difficult. I can't quite put my finger on it but having to sift through 10+ crates docs definitely left a very sour taste when I had to modernize one tokio 0.1 app to a 1.x one.

I do love Rust a lot as well but most of the time I am finding myself using either Elixir or Golang.