Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm asking this earnestly but is Go suitable for native GUI apps (not web)? 3D graphics/Games? Audio processing?


I've written a GUI in Fyne, it's decent but go is not a first class GUI language. Fyne is... fine but building code is annoying.

See https://GitHub.com/ssebs/go-mmp


Yes, because one can either turn off the GC, allocate memory up front (arena style), or call C or Assembly from Go.

The performance is likely to be good enough with GC turned on, though, because it is unusually fast.


Turning off the GC isn't the blocker. Plenty of GC languages manage.

I'm more interested in how Go handles graphics APIs and binding a render thread or working with GUI threads considering how goroutines are done. Does one need to write non-idiomatic go, avoiding goroutines or is there some trick?

For example, GTK isn't thread safe so you can't just use that library without considering that.


No, go is not for native gui apps. I recently made some rough go bindings to minifb and while easy to do, it wasn't productive at all. Errors are hard to follow; are they go or minifb? Callbacks work until I have too many calls then the app might freeze altogether.

Go is great for image/draw and things like passing pixels: (C.uint)buffer.Pix

It comes down to Google wanting Go to use the web as the interface, which in practice means not doing dynamic linking (except in Windows.)

To your question, go gui apps will have 'runtime.LockOsThread()' near the start so it's all green/light/go threads and only 1 OS thread.


Offhand, I think the general pattern is to bind related external libraries (E.G. a gui stack) into one agent thread and use channels to send it messages.


For games potentially Ebiten, I believe it has some audio processing support too.


Probably not Ebiten for 3d games. To be fair at this point when you are doing somewhat specialist things Go starts to lose its edge. I remember trying to replicate some Numpy code in Go and that was a pain. However that's just because Python is too good at scientific things.


People write games and GUI apps in Python, so why not?


Is there some particular reason Python is similar to go with regards to GUIs or are you saying everything can do everything?


Python is a slow interpreted language (I write Python every day). Go is compiled and an order of magnitude faster for most everything.

So, I guess, yeah, everything can do everything. Computers are fast where language is rarely going to be the deciding factor.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: