logoalt Hacker News

zadikianyesterday at 10:37 PM2 repliesview on HN

Lack of virtual threads was its biggest remaining problem because this made the common ways of doing cooperative multitasking very ugly. Go's big thing was having that from the start. Maybe now that Java has it too, it's set?

Though JS will still have the least boilerplate because of the way it handles types.


Replies

deepsuntoday at 12:04 AM

IMO, Kotlin coroutines are better of Go's goroutines, although they are a little different beasts to compare honestly (apples and oranges). Go inits goroutines on stack, but min size is 4KiB, so it's not trivial to grow them. Also you need to watch over and destruct goroutines manually to prevent memory leaks (using

   var wg = sync.WaitGroup
   defer wg.wait()

   wg.Add(1)
   go func() {
      defer wg.Done()
   }
)

And create a separate channel to return errors from a goroutine. Definitely more work.

show 2 replies
HendrikHensentoday at 7:30 AM

I think there is something to say for compiling to native code, having binaries in the ~25 MiB range, being able to run in distroless containers, being able to run a web application with less than 100MiB of memory and startup times measured in milliseconds rather than seconds (sometimes dozens of seconds).

Don't get me wrong, I like Java and don't very much like the Go language. But Java has a lot to improve upon still.

show 3 replies