News for hackers. Stuff that matters.
Re:Python Is Easy. Go Is Simple. Simple != Easy by mFixman on Monday November 27, 2023 @12:16PM (#38435023)
I used Go for many years. My issue is that it's _almost_ a great language, but in its current version it's just a collection of foot guns that makes it difficult to get shit done.

Go doesn't have some of the most library functions, so large codebases shared between teams end up with a dozen different implementations of functions like "minimum" or "filter". Good luck debugging a bug in one of the implementations.

The exception-less error handling would be great if they used sum types instead of (val, error) tuples. Return types are required to have a "default" value if you want to return an error, and good luck finding bugs where you use that value and forget the "if err != nil"`.

Worst of all, they removed most "fun" C things about pointers (like subtracting pointers in the same array) but kept the null pointers themselves. There's no way to ask for a not-null pointer at the type level, so you have to check for nullity everywhere and good luck debugging those runtime panics.

Re:Python Is Easy. Go Is Simple. Simple != Easy by willsmith72 on Monday November 27, 2023 @12:38PM (#38435325)
> a dozen different implementations of functions like "minimum" or "filter"

this is too real and my number 1 gripe with go

Re:Python Is Easy. Go Is Simple. Simple != Easy by patmorgan23 on Monday November 27, 2023 @02:24PM (#38436932)
And it's funny because go has a whole http server in the standard lib, but not minimum?
Re:Python Is Easy. Go Is Simple. Simple != Easy by kevincox on Monday November 27, 2023 @02:31PM (#38437027)
It couldn't have a minimum before generics. The function was not expressible in the general case. So they either would have had to add `minByte`, `minInt`, `minStr`, ... or make it a builtin generic. And every builtin is an admission that the language was not powerful enough, so those are kept to a minimum.
Re:Python Is Easy. Go Is Simple. Simple != Easy by yobert on Monday November 27, 2023 @03:01PM (#38437411)
I know it sounds funny, but I have used the built in "net/http" in probably fifty projects now, and not a single one of them needed a min/max function.
Re:Python Is Easy. Go Is Simple. Simple != Easy by porjo on Monday November 27, 2023 @02:33PM (#38437058)
Re:Python Is Easy. Go Is Simple. Simple != Easy by richbell on Monday November 27, 2023 @05:20PM (#38439248)
Since v1.21, which wasn't released that long ago.
Re:Python Is Easy. Go Is Simple. Simple != Easy by amelius on Monday November 27, 2023 @12:40PM (#38435366)
I tried Go for about a day, and the exception handling and null-pointer issues were exactly the things that made me lose interest.
Re:Python Is Easy. Go Is Simple. Simple != Easy by begueradj on Monday November 27, 2023 @02:09PM (#38436744)
Sorry to disagree, but you can not judge a whole programming language in one day (no matter what your skills and experience in other languages are). Most likely what made you lose interest in Go are simply things you did not grasp yet in one day.
Re:Python Is Easy. Go Is Simple. Simple != Easy by josephg on Monday November 27, 2023 @04:04PM (#38438257)
> Most likely what made you lose interest in Go are simply things you did not grasp yet in one day

It doesn’t take a day of use to be frustrated by go’s warts - like having nullable pointers everywhere, the lack of sum types and the awkward error handling. I think it takes more than a day to get used to those problems and work around them. And who knows if the juice is worth the squeeze?

Rust is the same. It takes less than a day to start fighting the borrow checker. Whether the language is worth the discomforts it brings is a question nobody can answer for you.

I think dismissing these criticisms by saying the poster just didn’t understand the language is overly dismissive. These criticisms are real and legitimate.

Re:Python Is Easy. Go Is Simple. Simple != Easy by BoiledCabbage on Monday November 27, 2023 @04:39PM (#38438769)
> the lack of sum types

Wait, Go doesn't have sum types? How do you create any modern programming language and not build it on top of sum types? That seems so odd.

Re:Python Is Easy. Go Is Simple. Simple != Easy by oooyay on Monday November 27, 2023 @12:51PM (#38435546)
The lack of true exceptions are annoying, but what kind of environment are you writing in that it's so expressly prohibitive to quit after a day? I've written error matching functions (and now there's errors.Is()) that mostly achieve the same things exceptions do, so I'm struggling to match being so overwhelmed by textual errors that you ignore every other improvement with the language over others.
Re:Python Is Easy. Go Is Simple. Simple != Easy by josephg on Monday November 27, 2023 @04:08PM (#38438297)
> what kind of environment are you writing in that it's so expressly prohibitive to quit after a day?

I think it’s admirable to try other languages for a day. I’ve spent less than a day noodling with dozens of languages that seem interesting. I’ve never tried dart, kotlin, elm or Scala. Why not? Is it prohibitively expensive? No. I just haven’t taken the time and the initiative.

More people should spend a day with go, even if they don’t stay around it’s still nice to learn something new!

Re:Python Is Easy. Go Is Simple. Simple != Easy by BoiledCabbage on Monday November 27, 2023 @04:42PM (#38438813)
Elm is a spectacular "weekend language". You really can learn the entire thing and get a solid feel for it in a weekend.
Re:Python Is Easy. Go Is Simple. Simple != Easy by klodolph on Monday November 27, 2023 @01:01PM (#38435681)
I can understand why you felt the need to share that, but if you only used it for about a day, aren’t you just reporting your initial impressions? If I used Rust for about a day, I would probably complain about the borrow checker. And if I used Python for about a day, I would have no idea what people are talking about when they complain about package management in Python.
Re:Python Is Easy. Go Is Simple. Simple != Easy by tikhonj on Monday November 27, 2023 @01:47PM (#38436406)
That's true, but the flip side is selecting heavily for public commentary from people who are already invested in—or at least generally open to—the tool in question. But, of course, that means selecting heavily against the people who see immediate, significant problems!

I've run into this problem repeatedly on Goodreads where wholly mediocre works get high ratings because of aggressive selection bias. I generally like fantasy, but I've stumbled on some painful stinkers thanks to this dynamic.

It's doubly reasonable to value first opinions on languages like Go since they intentionally aren't doing anything fundamentally novel. With a handful of exceptions, Go is a remix of ideas from mainstream languages that we've all seen before. It is about as far from a new paradigm for programming as you can get, and that's the point! Hell, that's the main thing people praise about the language: "I could pick Go up immediately, without needing to learn anything new"...

Re:Python Is Easy. Go Is Simple. Simple != Easy by madeofpalk on Monday November 27, 2023 @01:22PM (#38436009)
It's immediately clear (to me at least) what benefits you get from the 'pain' of borrow checking. I'm not sure what benefits you get from null pointer exceptions.
Re:Python Is Easy. Go Is Simple. Simple != Easy by pydry on Monday November 27, 2023 @01:37PM (#38436246)
It's pretty clear what the payoff is for the investment in using a borrow checker, and it's quite big. Less so for writing if err != nil on every. other. line. That's just an unnecessary nuisance.
Re:Python Is Easy. Go Is Simple. Simple != Easy by gwd on Monday November 27, 2023 @03:08PM (#38437515)
The payoff is the same: you do more work up front, but have fewer weird, hard-to-track-down bugs later. Even rust's "?" operator nudges you towards "just pass the error on up", rather than actually thinking about what you want to do if an error happens each time.
Re:Python Is Easy. Go Is Simple. Simple != Easy by amelius on Monday November 27, 2023 @01:40PM (#38436292)
Yes, and that is exactly what you don't want in a "get shit done" language.
Re:Python Is Easy. Go Is Simple. Simple != Easy by bborud on Tuesday November 28, 2023 @05:59AM (#38444524)
One day is not enough to even get a superficial understanding of any language.

People tend to always exaggerate how little time it takes to learn a language to a meaningful degree. Sure, the first day I tried Go I was able to accomplish something useful, but it took me a few months to develop a basic understanding of how you use Go in an idiomatic manner. I'd say it took at least a couple of years before I could say I "knew" Go.

And it wasn't exactly love at first sight. My initial impression of Go was that it was a bit too much like C, and, coming from Java, I was a bit confused about how you structure things. That takes time to figure out for any language. What sold me on Go eventually was that for my uses (writing multi-protocol server applications that run on multiple architectures), it resulted in code that was very readable and productivity more than doubled because Go is a lot less fussy to work in than Java. Both in terms of encouraging more minimal designs and having a lot less fragility.

Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @09:43AM (#38474088)
I disagree; you can learn 90% of Go in an afternoon. However, you also do have a point; the power of Go is not apparent in an afternoon, but in longer term and larger projects spanning years or decades, and hundreds or thousands of developers. It was made by and for Google to solve Google's problems, which include millions of LOC written and read by thousands of engineers over the span of decades.

So while at first you think "eww, err != nil everywhere", at least in a decade of reading your own or someone elses' code you'll know exactly what's going on.

How many languages are similar? I feel like a lot of languages in the past decade have had a steady migration in things like error handling, so 10 year old Java code is incomparable to today's Java. Whether that's a good thing (the language has evolved and is now more ergonomic) or a bad thing (I no longer know what's going on here) is the big debate.

Re:Python Is Easy. Go Is Simple. Simple != Easy by bborud on Friday December 01, 2023 @05:16PM (#38493267)
> I disagree; you can learn 90% of Go in an afternoon.

Learning a language only starts with knowing the formal spec. Then you have to learn how to express yourself efficiently and in mechanical sympathy with the language. That takes time. Worse yet, a significant portion of developers can't do it without a lot of help.

Re:Python Is Easy. Go Is Simple. Simple != Easy by Gibbon1 on Monday November 27, 2023 @01:09PM (#38435809)
I feel like the pointer stuff you could handle safely in a modern language. Because I think pointer and array notation are convertible so one isn't scarier than the other.

But yeah not being able to tag pointers as 'can't be null' and have the compiler enforce that ignores everything we've learned in the last 40 years. You shouldn't be able to pass a potentially null pointer to a routine that can't deal with it. You end up with code finding a null pointer without any context that tells it what to do with that. Or it panics.

Re:Python Is Easy. Go Is Simple. Simple != Easy by madeofpalk on Monday November 27, 2023 @01:24PM (#38436040)
Using pointers just to get a 'null' is just an annoying hack reflective of poor design. Instead, "no value" should be able to be directly represented.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @09:45AM (#38474116)
In Go that's the zero value, which is usually things like empty string, 0, [], etc; in most cases that's good enough.
Re:Python Is Easy. Go Is Simple. Simple != Easy by morsecodist on Monday November 27, 2023 @01:38PM (#38436256)
I could not agree more with this. Go is so frustrating to me because there is so much I like but these things you listed make it miserable for me to use.

A basic option and result type could fix a lot of the issues around errors and null pointers. I know languages like Scala, Haskell, and Rust have type systems that are often considered too complex but Go doesn't need all that to add these two.

Re:Python Is Easy. Go Is Simple. Simple != Easy by kevincox on Monday November 27, 2023 @02:30PM (#38436999)
"Defaults are useful" was IMHO the biggest mistake Go made. I understand that it made the language a lot simpler but this was a simplification that ended up moving the complexity to the user, rather than just removing it.

I have seen so many bugs caused by default values, production outages. Plus the code is harder to understand because you need to consider the default value case, and make sure that it is only left at the default when intended, not by accident. (And the linter probably can't warn you because it isn't wrong to have the default value live in one path through the code).

One of my favourite things in more strongly typed languages is just adding a field to a struct then having the compiler point out everywhere that I need to make changes. The strictness both prevents bugs and saves time. Plus the code doesn't need to worry about invalid structures, you can often write code such that they literally can't exist.

Re:Python Is Easy. Go Is Simple. Simple != Easy by stouset on Monday November 27, 2023 @02:43PM (#38437178)
Not to mention, some things just don't have a sensible or sane default. Needing the zero value to be meaningful has had so many negative downstream effects (nil being one of them) it's crazy people still defend this decision.
Re:Python Is Easy. Go Is Simple. Simple != Easy by arp242 on Monday November 27, 2023 @02:53PM (#38437295)
A huge downside of that it that adding a new (public) struct field will be an incompatible change. And what people will do is add a non-public struct field with a setter method, both to avoid the compatibility break but also because for many of these fields the defaults are just fine (even though sometimes they're not) and no one lines having tons of boring boilerplate.
Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Tuesday November 28, 2023 @04:32AM (#38444044)
Not sure. If you declare a variable as of type string i think it really good that it is empty string as default. The other option is to be null.
Re:Python Is Easy. Go Is Simple. Simple != Easy by kevincox on Tuesday November 28, 2023 @06:50AM (#38444762)
I don't think it is. We had a production outage because someone was putting things into a map with the wrong key. Tests passed because they read (using a right key) and checked that they got a valid value. In this case an empty string was "valid". (Basically it deserialized correctly.) Sure the tests could have been better but this also wasn't the only bug due to default values. Imagine if 1% of the time the result of addition was randomly 5, it would cause havoc. Default values are the same. Sure, often they are a reasonable value, but when values that the coder didn't expect enter the system you are going to have a bad time. If the map reads failed tests would have failed, but also the crashing service would have been reverted and the problem found before it caused any real trouble. Not silently corrupting out data for a week.

The other option isn't null, the other option is an error. Ideally the code fails to compile. 99% of the time I would rather have an error than have my code silently be wrong. Failure is almost always better than corruption. (Don't get me started on Go's fmt lib that barfs crap into the output if you have your format string wrong, at least that is easy to lint for most of the time) And build failures are almost always the best because then the wrong code can't even make it to production.

Re:Python Is Easy. Go Is Simple. Simple != Easy by hectormalot on Monday November 27, 2023 @04:09PM (#38438314)
Indeed. I enjoy working in Go and have written various things in it over the last 8 years. Last year I toyed with Rust (very different learning curve!) and still prefer Go for its simplicity and development speed. But, I would love to have Rust-style enums in Go. The 'similarly named constants pretending to be enums' and 'returning nil if not found' patterns suddenly started feeling wrong.
Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Tuesday November 28, 2023 @03:54AM (#38443754)
Having used Ocaml for quite some time, i can understand this. However, i cant tell people (junior devs, or devs who just want to work and does not care about comp-soyery) to learn an ML (+ all the FP idioms) with a straight face.

Having a (val, err) tuple IS more easy than returning a monad.

Sometimes (most times?) pure procedural code is just the best, and i really hate languages that have feature X but does not support it fully.

As an example i would not be happy with an monadic return type if the language did not have the option to use some sort of bind/return combo, and have full pattern matching support.

Thats why i champion Go for larger teams. Almost anyone can join the team in dive in without much previous Go knowledge. This is a rare feature and i dont know many other languages that has this property.

Re:Python Is Easy. Go Is Simple. Simple != Easy by morsecodist on Tuesday November 28, 2023 @11:37AM (#38447634)
You really don't need to think about monads or functional programming to have option and result. The focus on explaining these in the context of sum types and monads only serves to distract most people. A list is a monad and people use them every day and they are fine.

> Having a (val, err) tuple IS more easy than returning a monad.

Arguments about which concept is easier for people to understand pretty quickly descend into subjectivity but I don't believe this is universally true. Why am I getting a value when there's an error? What do I return as my value when returning errors? Explaining to someone that a function returns (val, err) and only one of these values will be significant is more or less the same as describing a result.

Option is even simpler. It's a list that can have at most one item. Or, you know how in python you can set a variable to None? Here's how to do it in a strongly typed language.

Re:Python Is Easy. Go Is Simple. Simple != Easy by lenkite on Tuesday November 28, 2023 @01:00PM (#38448721)
I like Go for its standard library but truly hate its nil behaviour and default value semantics. Uber effectively built a static analysis tool from scratch to catch nil issues: https://www.uber.com/en-IN/blog/nilaway-practical-nil-panic-...
Re:Python Is Easy. Go Is Simple. Simple != Easy by bunderbunder on Monday November 27, 2023 @01:38PM (#38436262)
This roughly lines up with my feelings. Go is a solid improvement over many languages that we inherited from the 70s, 80s and 90s.

But it also retains a certain "we don't need a robust type system; weak-ish static typing is good enough" ethos that made sense in back then, when compilers were hard enough to write that it was easier to justify making the programmer handle more things manually for the sake of simplifying the compiler authors' job.

This is always a tradeoff, of course, but I think that the optimum balance has shifted even further in favor of programmers. Some of Go's decisions still made sense in the 2000s when the language was first being created. But now, 15 or so years later, I think many of us could be forgiven for wishing for a language that's a lot like Go except that it dared to dream just a little bit bigger.

Re:Python Is Easy. Go Is Simple. Simple != Easy by danenania on Monday November 27, 2023 @01:47PM (#38436402)
I think the key question is how robust a type system can be while keeping compilation extremely fast. Slow compilation absolutely destroys developer productivity.
Re:Python Is Easy. Go Is Simple. Simple != Easy by hardwaregeek on Monday November 27, 2023 @02:42PM (#38437163)
You can make it pretty darn robust! OCaml compiles very quickly and has a good type system. Rust is slow due to LLVM, macros, and the compilation unit being the entire crate. None of these are requirements for a good type system
Re:Python Is Easy. Go Is Simple. Simple != Easy by bunderbunder on Monday November 27, 2023 @03:06PM (#38437487)
Zig's new compiler is a nice example of how you can do all sorts of inherently slow things at compile time and still have a lightning fast iteration time for developers if you design your toolchain for incremental compilation instead of making the compilation unit be the entire module the way Rust did.
Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @02:07PM (#38436712)
Conversely I could go longer between compiles if the type system caught more.
Re:Python Is Easy. Go Is Simple. Simple != Easy by arp242 on Monday November 27, 2023 @02:49PM (#38437241)
Most of the times when I really care about quick feedback cycles is when I'm experimenting to see what approach does and doesn't work well in the first place.

I care a lot less about it for "simple" errors like typing errors, typos, or whatnot. This is mostly trivial stuff compared to "is this entire approach good or not?"

Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Tuesday November 28, 2023 @06:31PM (#38453147)
I think I agree with you, but in trivial projects even the infamous slow compilers are fine. Toy Rust projects and small Java projects get compiled very fast.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @07:10AM (#38472521)
It doesn't even have to affect compile times per se, it could be a linter/checker task running separately from the main compiler; most type errors are only relevant during development in my experience. Said experience lately is a lot of Typescript, where all type information is no longer relevant at runtime because it's compiled out or just bluntly removed to make it valid JS (I dunno how the TS compiler works).
Re:Python Is Easy. Go Is Simple. Simple != Easy by anta40 on Monday November 27, 2023 @02:39PM (#38437116)
Yep this is one of the reasons lots of my friends switched to Go: short compilation time (like good old Pascal days).

Rust & Haskell is a big no :p

Re:Python Is Easy. Go Is Simple. Simple != Easy by bunderbunder on Monday November 27, 2023 @03:12PM (#38437577)
But we're not talking about replacing Go with something like Rust or Haskell here. We're talking about really basic, inexpensive things like not repeating Tony Hoare's billion dollar mistake yet again. Or actual structured error handling instead of something that's ergonomically quite similar to classic C-style error handling aside from the relatively incremental improvement of not relying on global variables.
Re:Python Is Easy. Go Is Simple. Simple != Easy by bborud on Tuesday November 28, 2023 @05:38AM (#38444403)
I'm not so sure that we're necessarily talking about small, inexpensive changes here. Anything that changes the fundamental character of a language is probably going to have bigger consequences than you might imagine.

I've been writing a fair bit of C lately. I'd say that the way Go error handling works has exactly nothing in common with C. Despite spending 15 years mostly writing C on UNIX 20 years ago, when returning to C it was striking how little Go's convention of returning multiple values, with the error being the last, has in common with C.

And if by structured error handling you mean things like exceptions: I don't really see how that improves error handling from a readability or security point of view. In Java people can't even agree on whether or not to use checked exceptions (ie neuter any perceived advantage of exceptions), and syntactically, exceptions are a little bit more awkward than return values as you invariably create nested scopes and move the handling of exceptions away from the normal program flow - which is not a readability win.

But I'll grant you that the error type in Go was both a bit vague and there was a lack of sensible stuff to, for instance, wrap and accumulate errors initially. But that has gotten better.

Re:Python Is Easy. Go Is Simple. Simple != Easy by bunderbunder on Tuesday November 28, 2023 @11:23AM (#38447434)
Ergonomically, the thing that Go and C have in common about error handling is the thing that the grandparent pointed out - you don't get much language-level support in helping you to remember to check for errors. If you forget, then there's a decent chance that the error condition will be allowed to silently propagate.

Structured error handling is as opposed to exceptions. I think that the most famous implementation these days is Rust, but if you want to see a version that isn't built on top of an ML-flavored type system, check out Zig's implementation of the concept: https://ziglang.org/documentation/master/#Errors

Re:Python Is Easy. Go Is Simple. Simple != Easy by bborud on Tuesday November 28, 2023 @03:04PM (#38450499)
Error handling is tricky because it is (usually) people who write code, and people are lazy and sloppy. Force people to deal with errors and they'll find new ways to not really handle errors.

I'm not opposed to language support for pushing developers to handle errors. But experience suggests it isn't the magic bullet we sometimes tend to think it is.

Re:Python Is Easy. Go Is Simple. Simple != Easy by bunderbunder on Wednesday November 29, 2023 @10:18AM (#38460411)
Completely agreed.

I'm only responding to point out that I never claimed or even implied that there's such a thing as an error handling magic bullet, just that I think that Go's approach to error handling has been oversold. It compares favorably with an "enterprisey" approach to exceptions, precisely because that method makes it so easy to hide the dead bodies. But I don't love that Go's (and C's) approach makes it so easy to implicitly suppress errors, because that's effectively the default behavior. In a language that forces you to check for errors, by contrast, it's harder to be lazy and sloppy without being explicitly lazy and sloppy, which then means that such behavior is more likely (not guaranteed - again, I'm not trying to claim a panacea - just more likely) to be noticed during code review.

Re:Python Is Easy. Go Is Simple. Simple != Easy by ninkendo on Tuesday November 28, 2023 @08:49AM (#38445639)
> not repeating Tony Hoare's billion dollar mistake yet again

This is the killer for me. After using Swift for a while, I no longer have the tolerance for languages that don’t have proper option types (and perhaps more importantly, which don’t use option types pervasively and by-default.) It’s just 100% the wrong way to design a language nowadays. Option types are table stakes.

Re:Python Is Easy. Go Is Simple. Simple != Easy by bunderbunder on Tuesday November 28, 2023 @11:15AM (#38447333)
It doesn't even have to be ML-style option types. Kotlin is a great example of an alternative implementation that arguably has much better ergonomics for procedural and object-oriented code.
Re:Python Is Easy. Go Is Simple. Simple != Easy by kuchenbecker on Wednesday November 29, 2023 @04:06PM (#38465323)
Additionally, codegen and templated metaprogramming is very fast in go. Gen + Compile + Lint + Test on Save with line-by-line coverage overlay in <10s.
Re:Python Is Easy. Go Is Simple. Simple != Easy by afandian on Monday November 27, 2023 @05:48PM (#38439613)
I’ve used a number of languages over the years and I have never been more productive than with Kotlin.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @07:09AM (#38472503)
I'm wondering if there will be a language that compiles to Go, like Typescript is for Javascript, that adds a stricter type system (and fixes other issues) and adds a compiler step, but still has all the other benefits of Go.
Re:Python Is Easy. Go Is Simple. Simple != Easy by d0mine on Monday November 27, 2023 @09:30PM (#38441563)
> 70s, 80s and 90s

It reminded me of Go vs. Algol-69 http://cowlark.com/2009-11-15-go/

Re:Python Is Easy. Go Is Simple. Simple != Easy by bborud on Tuesday November 28, 2023 @05:12AM (#38444256)
Language design is always easier in retrospect. It is harder than it looks, and often harder than the people designing a language realize before it is too late.

I think it was a good choice to take smaller steps and try to not be too ambitious too soon. Sure, Go isn't the most sexy language from an academic point of view, but it has a certain conservative and pragmatic approach that does work. It does generally result in code that is a lot easier to read and maintain than is my experience with C, C++, Java, C# and a few other languages I've worked in.

Go is an engineering language - not an academic exercise.

Take, for instance, the approach to generics. They could have designed that in from the beginning, but they showed restraint and didn't. That probably took a fair bit of courage. It is my impression that they hadn't figured out what generics should look like in Go, so they postponed until they had a better feel for how it ought to be done. Rather than risk making choices that would be hard (impossible?) to rectify later.

When you add something to a language there is always the risk that you make it worse.

(I'm not making any qualitative judgements on Go generics since, frankly, I don't feel qualified. I make very sparing use of it because it really isn't that often I actually need to make use of it)

People tend to forget that Java didn't have generics until 1.5 (or 5.0 or however they prefer to version it now) - about 9 years after first being launched. And to be frank, that was not a fun experience at all. Not so much because there was something wrong with the design, but because suddenly a lot of people went overboard and started designing really hairy types that could be hard to figure out and use.

If you consider C++: C++ spent 20+ years flailing wildly and the result was that you got lots of different C++ "traditions", subsets and practices. Sometimes within the same company. Depending on which era or tradition a C++ codebase is from you may have to adjust to a wholly different way of programming from what you are used to or prefer. And as for generic programming: in what world is STL a neat solution? And to this day, compilers are slow, they produce rubbish error messages, the toolchain still feels like a 1970s ad-hoc mess, and there is no definitive way to build things, resulting in lots and lots of additional complexity when trying to tame the horrific tool chain.

Sure, they could have put loads of stuff in Go from the beginning. But I think they would have gotten a lot more wrong if they had. I really appreciate that they are evolving the language slowly and conservatively.

Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @07:06AM (#38472484)
> Go is an engineering language - not an academic exercise.

Great summary. I personally think Scala is the antithesis to Go, it being an academic exercise - with complexity and tooling to boot.

re: Java generics, I've got this comment from 2015 bookmarked, it's a great explainer about the decision process behind adding generics to Go and the problem(s) with Java's implementation: https://news.ycombinator.com/item?id=9622417

Re:Python Is Easy. Go Is Simple. Simple != Easy by bborud on Saturday December 02, 2023 @06:46AM (#38497916)
Thanks for posting that link. It lead to a lot of interesting background material! I think this quote in particular resonates:

  > those ideas simply haven’t had time to pass through the filter of 
  > practical experience
Re:Python Is Easy. Go Is Simple. Simple != Easy by bunderbunder on Monday December 04, 2023 @10:46AM (#38518676)
I remain somewhat unconvinced on that front. There were good implementations from outside the functional programming sphere (which seems to be what people from the Go space tend to mean when they say "academic") already existing at the time. I think the real problem is that the most well-known examples, C++ STL and Java 5 generics, were trying to stick generics into an existing language with a "some things are objects and some things are not objects" type system. My take on the story there is that generics called attention to some deep deficiencies in that kind of type system, and people responded by shooting the messenger.

Languages like C# (which I've used extensively) and Eiffel (haven't used in anger), on the other hand, have a consistent type system, and didn't seem to have the same problems with generics that Java and C++ did. Or for a non-object-oriented model that has some other features that might be attractive to Go, such as not allowing implicit specialization, there's Ada.

Re:Python Is Easy. Go Is Simple. Simple != Easy by tick_tock_tick on Monday November 27, 2023 @03:01PM (#38437398)
Go doesn't have some of the most library functions, so large codebases shared between teams end up with a dozen different implementations of functions like "minimum" or "filter".

Does https://pkg.go.dev/slices#DeleteFunc not work for you or do you need it to be called filter? It's there for maps too https://pkg.go.dev/maps#DeleteFunc

Re:Python Is Easy. Go Is Simple. Simple != Easy by mFixman on Monday November 27, 2023 @03:16PM (#38437617)
To be honest, I used to use Go before generics became a thing.

I'm glad that they implemented some basic library functions 10 years down the line.

Re:Python Is Easy. Go Is Simple. Simple != Easy by tick_tock_tick on Tuesday November 28, 2023 @06:16PM (#38452963)
Yeah no offense but most of the people online that I find complaining about Go used it a long time ago or got their talking points pre-generics and haven't touched it or really looked at it since then.
Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Tuesday November 28, 2023 @03:46AM (#38443701)
A general "min/max" function could be implemented with Generics?
Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @09:46AM (#38474137)
And has, since Go 1.21, but that's very recent so everything written before August this year may have the problem of a min/max utility and the like: https://go.dev/blog/go1.21
Re:Python Is Easy. Go Is Simple. Simple != Easy by Mawr on Friday December 01, 2023 @11:22PM (#38495840)
> There's no way to ask for a not-null pointer at the type level, so you have to check for nullity everywhere and good luck debugging those runtime panics.

You can write a simple Option type yourself using generics [1]. It's not strictly idiomatic and you do have to remember to use it, but it works well.

[1]: (my post) https://news.ycombinator.com/item?id=38331565