Hopefully generics alleviates some of this boilerplate.
It will be nice not to have to do that, though, if I get back to Go again.
[0]: https://github.com/golang/go/wiki/SliceTricks#additional-tri...
https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...
No need to alter the type system of the language, while it’s clearly a syntactical improvement you’re looking for.
(ps: Hi, Ed!)
I'm excited and anxious about generics in go.
Using interface{} where you truly don't know and can't predict the data being sent to you is mostly something that libraries (like encoding/json) have already handled, so I don't have to interact with it much directly.
I think generics are going to have the biggest impact in adding effortless type safety to all kinds of libraries, though.
You can potentially test this for yourself by opening two large open source projects in each language and trying to figure out an issue from their issue tracker.
FWIW I think their complain even if not totally objective still have more weight as compared to non-users who say "I will use Go only when it has real generics/error handling/sum types/21st century features blah..blah.."
If not, there are a lot more non Golang programmers out there than there are current Golang programmers.
I wanted to like go for its crossplatformness, compile speed and relatively small memory usage while still being more practical than C++.
But not having generics and having to constantly check for errors was the two big things that made me bail.
Just to clarify, I don't want exceptions, I just want some language mechanism that changes err, value to be errOr<value>, which if passed to any function while an error will just propagage that to the return value of the function.
Maybe for extra sugar something like errOr<value> | valueToUseIfError. This makes the code nice and thight, mean that I don't have to declare variables to give them one value to pass into the arguments of the next function and still perserve all the nice properties of Go.
Also a nice cross gui library would be nice, but that is a lot harder. Still 20 years on the best cross gui library that compiles once and runs anywhere is Java...
Yes that is indeed the next most-frustrating thing about Go! In the last Go language survey (https://go.dev/blog/survey2020-results), about 90% of people wanted generics and 60% of people want better error handling. So, one down, one to go.
Modern languages like Zig and Rust show how you can do "errors as values" way better. Zig has error returns and stack traces built in, there's no reason Go has to be so impoverished here.