by gadflyinyoureye · 3y ago · 0 comments
There are a lot of foot guns. nil slice? Fine. nil map? Segfault. Loop variables with closures. The list goes on.
Generics seemingly split the community. May be some libraries won’t get used because they picked the wrong side.
It’s surprisingly weak at modeling data. Union types would really help out.
The community is so anti-design that it’s hard to play with them. Most want to make a big ball of mud and call it agile. When you point out simple patterns, they call you an Architect Astronaut. Checkout r/golang. Also look out for people telling you how dumb you are for wanting generics.
In many cases it’s a step backwards but it has the positives you posted. That is often a reason to grin and bear it. Eventually Stockholm Syndrome kicks in.
I haven't really observed that at all.
One thing that is going on is there hasn't been a massive disruption while everyone stops to rewrite the world in generics, and generics are not suddenly everywhere, which is what some people had predicted would happen. I think part of the reason is that in some cases another solution (closures or interfaces or whatever) can be a better fit, and the evolutionary approach to generics that Go took means you can use generics in conjunction with non-generic libraries or other pre-existing approaches without suffering from an ecosystem split.
indeed a brutal footgun but will be fixed soon
A fix for the loop variable closure problem is now in the official proposal process, which is how language changes happen in Go.
It’s a concrete proposal from the core Go team and seems to be on track for acceptance:
https://github.com/golang/go/issues/60078
An implementation is already available on tip and in the upcoming Go 1.21 release behind a GOEXPERIMENT flag.
The community reaction has been extremely positive. As one approximate measure, an earlier draft of the proposal had 671 upvotes and with 0 downvotes: