4 ms·
Go Turns 15
- deleted 2y ago[deleted]
- tapirl 2y ago> Go 1.22 made variables introduced by for loops scoped per iteration, rather than per loop, addressing a long-standing language “gotcha”. This does fixes the "for-range" loop gotcha, but brings several gotchas to the 3-clause "for;;" loops: * https://go101.org/blog/2024-03-01-for-loop-semantic-changes-in-go-1.22.html https://go101.org/blog/2024-03-01-for-loop-semantic-changes-... * https://github.com/golang/go/issues/66156 https://github.com/golang/go/issues/66156 * https://x.com/zigo_101/status/1856173025839960333 https://x.com/zigo_101/status/1856173025839960333 * https://x.com/zigo_101/status/1854918262523621805 https://x.com/zigo_101/status/1854918262523621805 * https://x.com/zigo_101/status/1854213142177624169 https://x.com/zigo_101/status/1854213142177624169
- nine_k 2y agoTo me, it's not a gotcha. As the github issue discussion notices, loops where the semantics depend on the identity of the loop variable to remain the same over the 3-clause loop iteration is exceedingly rare. I'd also say it's contrived and should not pass a code review. Funnily, a 3-clause loop in Go (and in C) is actually a reduce(), where the loop variable's value, possibly touched by the iteration, is then directed back to the next iteration. This makes it more powerful (e.g. can traverse graphs, etc), but also more complex than it looks in the case of an integer and increment.
- ChrisArchitect 2y ago> So much has changed since Go’s 10 year anniversary, Discussion then: https://news.ycombinator.com/item?id=21483933 https://news.ycombinator.com/item?id=21483933
- phplovesong 2y agoGo is one of those languages you get shit done. Its fast, it compiles fast and is type safe enough. It has a rich stdlib and comes with pretty much all you need (formatter, lsp, testing). Overall Go is really good, but not perfect. A few minor things are missing (like adts/pattern matching). But i want to belive that go will one day have them! HBD Go!
- jakebasile 2y agoI've become a lot more positive on Go over the years. I tried it a few times starting from when it was released and always found some roadblocks that aggravated me enough not to keep going except for toy projects. They've pretty steadily been removing those even if they keep others, but on the balance the benefits of the language outweigh the remaining drawbacks for me when I'm looking to make something where Go shines such as when a single static binary is a benefit. Overall I still prefer to work in Clojure, all other things being equal, but Go is a nice tool to add to the belt. A huge one for me was the lack of a reasonable project structure - they expected all your Go code to live in one huge directory nested deeply by the import path. It probably worked fine inside Google due to their reputed giant monorepo but it was aggravating to me who has a (much more common, I think) `~/Code` directory with a bunch of projects in it, one level deep. They fixed this along with managing dependency versioning with `go.mod` and `go.lock` files some versions ago and it completely eliminated the problem for me. Generics was another one. I don't love generics but there are some classes of code for which a lack of generics only leads to pain. It's nice that they finally added them. One thing that hasn't changed is their amazing commitment to not breaking existing code. It's really nice to pull up an old project, update the version in `go.mod` (or add one if it didn't exist) and things Just Work™ along with whatever extra benefits you gain from the version upgrade. They clearly did extensive research to avoid breaking even what I consider extremely non-obvious and borderline erroneous behavior (that for loop thing) and did it in a way that makes sense. Their standard lib is good, and pretty well documented. I can often get what I need without having to resort to pulling in a dependency or writing it myself. That's handy. The VSCode support for it is top notch and also Just Works™ in my experience. There's no REPL of course but the debugger can fill a similar role aided by the extremely fast compilation time.
- tapirl 2y ago> One thing that hasn't changed is their amazing commitment to not breaking existing code. Er, are you sure? * https://x.com/zigo_101/status/1856173025839960333 https://x.com/zigo_101/status/1856173025839960333 * https://x.com/zigo_101/status/1854918262523621805 https://x.com/zigo_101/status/1854918262523621805 * https://x.com/zigo_101/status/1854213142177624169 https://x.com/zigo_101/status/1854213142177624169
- VeejayRampay 2y agogo is the boring language that gets stuff done, perfectly suited for that class of people who care only about outcome
- relistan 2y agoThis language has been a huge boon to our field: simple to learn, easy to support, capable of excellent performance, delivering long term compatibility for production code, and with one of the fastest compilers around. I think people now forget how much impact Go’s command line tooling has had on user experience for developers. Everyone copied it. I was skeptical of the language at first but have worked mostly in Go for the last 11 years and it has been a joy. Happy 15th, Go!
- andrewstuart 2y agoSimple wins. Golang and Rust were once peers, both new languages at around the same time. This is why Golang has gone mainstream and Rust remains niche.
- deleted 2y ago[deleted]