×
Login Register an account
Top Submissions Explore Upgoat Search Random Subverse Random Post Colorize! Site Rules
10

Go finally has generics

submitted by v0atmage to programming 2.2 yearsMar 20, 2022 11:25:51 ago (+10/-0)     (go.dev)

https://go.dev/blog/go1.18



7 comments block

While your post is a tad hyperbolic, I've written a fair bit of code in Go, and I now find myself unwilling to start a new project in it. It's the kind of language that looked really good on the surface, but the reality of using it isn't nearly so rosy.

The fundamental idea that sounded so good was that it would be a better C than C for many applications, but actual use revealed it to be a more concurrent and generally performant Python. It's not a tremendously ergonomic language, either; the constant "if err != nil" spam is only the tip of the iceberg. Everything about it is just a little bit weird and non-standard. For a while at least, it made syscalls directly instead of going through the OS-provided libc, which led to all kinds of fun, especially on Apple platforms, where a new release of the OS could require you to recompile your program with a new version of the compiler. But hey, at least it meant that you could have statically-linked executables that didn't even need libc. They only end up being a few dozen megabytes in size for any remotely interesting program.

The idea of using Git repositories for package management also sounded like a good idea to many people until they saw it first-hand. Now there's a somewhat awkward (and potentially soon censored) module system that makes the whole process easier until you run into a library that doesn't use it. I recall really struggling to get the module system to do what I wanted it to last time I wrote serious Go code.

Even its interoperability with C wasn't all it was cracked up to be. We ended up with comments that get interpreted by the compiler, something that anybody with a brain should know is insane. On a related note, platform-specific code ended up getting two different mechanisms: one that uses interpreted comments and one that uses special file names and sucks.

Channels were just about the only thing in Go that was legitimately good, and now other languages have adopted them, nullifying that one advantage.

I think Go is going to end up going through many of the same pains as Java did when it added generics post-1.0, but I can't imagine the transition will be managed as well. I'll be watching and laughing from the sidelines.