3 ms·
> Go is boring and that's not good. Wow, I couldn't disagree more. This is a good quality because it means that the language is very conservative in features.
by imiric 2y ago
> Go is boring and that's not good.
Wow, I couldn't disagree more.
This is a good quality because it means that the language is very conservative in features. The authors quite deliberately chose to keep a minimal featureset, which is shockingly difficult to do in practice. Languages that cram every feature under the sun are behemoths that are difficult to develop and, more importantly, use. Any experienced programmer can read the Go language spec in an afternoon, and be proficient with it in a week. You can't say the same about most other languages.
Those missing "bare essentials" like maps, filters and contains are just syntactic sugar, and hardly essential. I've worked with Go for nearly a decade now, and have never heard of samber/lo, nor needed it. This mentality that developers need helper functions for every task is what leads to ridiculous ecosystems of micro-libraries that are popular in the JS world, which is a huge supply chain security risk.
I mean, take a look at this example from samber/lo:
lo.Times(3, func(i int) string {
return strconv.FormatInt(int64(i), 10)
})
How is this better than a standard for loop with `append`? One uses standard language features and is obvious to anyone reading it, and the other depends on an external library and everyone being familiar with it to understand. If I saw this code in the real world I would strongly vouch for removing it.
To be honest, I'm _not_ a fan of such helper functionality creeping into the language. I'm not a fan of generics either, and I'm not sure they're a net benefit to the language.
> In Go, there's only one way to do things. [...] this part of Go’s boringness is just untrue.
This is untrue is most other languages as well, but at least Go authors strive to stick to this as much as possible. Whereas this is not even a core principle of other languages, or they even encourage the opposite. If we agree that TIMTOWTDI is a mistake, then the best we can do is to consciously reject it. How well this succeeds in practice is debatable because it is a very hard design problem.
I have many more fundamental disagreements with the author, but can't be bothered to address each one. To me Go is a breath of fresh air in a sea of broken languages and ecosystems. It's far from perfect, of course, but it's many times more enjoyable to use than anything else I've come across in the last ~20 years, most notably Python, JavaScript and Java.
- em-bee 2y agothe author also complains that There is only one way to loop (for). that seemed odd to me. i thought is go really that limited? for loops used to be the bane of programming. that can't be true, and it isn't. it just happens that things like while or foreach or however they are called in your favorite language are all done with the same for keyword. is that bad? i don't know. as for map/reduce, in most languages that i am familiar with those are functions. and nothing prevents go to have these functions too. if they are not in the standard library, add them. there are multiple implementations available. eventually one will make it into the standard library.
- p2detar 2y agowhile-loops are also seldom used in Java code. At least from my observations. For-each and stream functions have deprecated for/while in modern Java code. As a Java dev, I love Go by the way. Recently adopted it and I find it anything but boring.
- em-bee 2y agoagreed, i use while very rarely in any language. iterating lists is really the main use of looping, so some form of for-each is my preferred tool. even when a traditional for loop is better, my first instinct is to try for-each first. it's a pity that javascript's forEach is so awkward to use, needing a callback. i remember when pike's foreach was extended from only handling arrays to also supporting mappings and anything else iterable, it felt like a massive improvement. go's for/range syntax is a bit different, but it does the job. i could not ask for anything more.