EDIT: HN upvote system has nothing to do with right or wrong or constructing a good discussion, it's based on fanboyism and political correctness. Really sad.
EDIT: HN upvote system has nothing to do with right or wrong or constructing a good discussion, it's based on fanboyism and political correctness. Really sad.
I think go promotes maintainability rather than developer productivity. IMO, go authors favored ease of code reading to the expense of code writers. That being said...
> no option types aka nil access, no enforcement of error checking aka no result types, no enums, no conditional compilation, no iterators, no immutables, etc...
No enforcement of error is not true, you have to explicitely ignore an error if you want to. You have almost the same problem with rust, where you can unwrap things that can fail, thus explicitely ignoring potential errors (granted, the program will then panic).
No conditional compilation is not true either, you can, eg, put at the top of your file build tags:
// +build !linux
This file won't be compiled on linux (you supposedly have another version of that file for linux systems).No immutables: can be a problem, const is very limited indeed in go.
Nil access, yes, although contrarily to C/C++, you can't dereference nil without having the program panic. AFAICT I never had them happen in production, when I have a panic it's because of an off-by-one error in a slice, usually (but then I'd have the same problem with `safe` languages like rust).
I'd be glad to have enums. Go's workaround is safer than C's enums, but not by much.
It seems to promote verbosity just for the sake of so called "simplicity". It's simple (almost dumb) at the language level, which just pushes complexity elsewhere.
This is just a statement that I find some people repeat without any substantiation whatsoever.
> you have to explicitely ignore an error if you want to
err := foo()
...
err = bar()
if err != nil { panic(err) }
The first error was unintentionally discarded. I've seen this happen in actual code bases.I don't think simplicity is the goal, I think simplicity is a mean to an end, and that end is readability. I remember reading some C++ code I didn't write, and I couldn't understand where the bug was coming from. Turns out the developer had redefined the () operator (or something like that) so that it behaved quite the same as expected, except in a few corner cases.
That's the kind of bug hunt go preserves you from, but verbosity is the price you have to pay.
> The first error was unintentionally discarded. I've seen this happen in actual code bases.
You're right, and AFAIK linters don't catch these.
However when deploying server binaries it's a substancial advantage. End users like them. Ops like them.
On server I am deploying 250MB TensorFlow on a _free_ cloud tier.
Not sure what are you talking about.
I also bet Java or .NET would be speedier than Go after warmup.
I don’t even particularly like Go. It just seems to be the best solution for command-line apps in 2020.
Nowadays OpenJDK, OpenJ9 and GraalVM offer AOT for those that aren't willing to pay for such SDKs.
As for small, Go binaries aren't necessarily that small.
I also bet that Java value types will be available in the language earlier than any Go compiler with generics support.
There is a lot of hacky code in the code generation space, which is why I think the Go team continues to chase generics rather than give it up completely.
A lack of optional types is IMO a wart, that’s tapered over with nil and reflection, but would have benefitted from being a first class piece of the language. I like to imagine this finds its way into Go 2, but I’m not very hopeful.
The rest of your items I view as very nice things that I don’t particularly miss. They’re quirks that are reflective of a minimalist design. At least, that’s the excuse I make.
Result types are interesting and valuable, but add a layer of complexity to a program’s legibility that is understandably desirable to omit, especially when the idiom of returning an error type is so culturally ingrained.
I miss immutables and “modern” iterators, but I can personally live without them. Conditional compilation is kind of antithetical to Go’s design and I don’t miss it too much.
I think most Gophers who have been around the language a while would agree with most of what we’ve said, at least the ones I know.
But there are so much more to an ecosystem than the language itself. People pick Go, despite its language shortcomings. That should be telling to a lot of other ecosystems out there.
Also, the niche it carved out has no other language that fits equally well, I think.
> HN upvote system has nothing to do with right or wrong or constructing a good discussion
Spot on again. You are probably getting a hundred downvotes :(