News for hackers. Stuff that matters.
Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Monday November 27, 2023 @11:48AM (#38434585)
No matter what your opinion is about Go (as a language), but they nailed it for bigger projects.

Go code always looks the same, performance is predictable and fast enough for most programs, and its really, really easy to be productive. When i picked up Go i basically got shit done without ever having written a single line of Go.

Its statically typed (with generics yey!) and compiles very fast. Its easy to create small binaries and cross compilation ”just works”.

Go projects usually dont have many dependencies, but IF you need something there always a package for it.

Go takes BC serioisly, 10 year old Go code compiles (usually) fine with the lastest version.

Overall its a really good ”get shit done” language, and a good fit for larger teams

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

Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @12:14PM (#38434997)
As someone with the misfortune of inheriting a million plus loc Go project I disagree. Go is a nightmare from the duck typing to dependency management.
Re:Python Is Easy. Go Is Simple. Simple != Easy by bogota on Monday November 27, 2023 @12:39PM (#38435347)
I assume with the duck typing you are talking about interfaces? How has that caused issues?

With huge projects that pull in packages i have seen the dependency management become a mess but most of the time its not that bad.

Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @12:48PM (#38435486)
It was sloppy coding on the project I took over, but it still made me wish for explicit style interfaces. Cleaning up frequently broke the project in non-local ways, because someone would break an interface without meaning to.
Re:Python Is Easy. Go Is Simple. Simple != Easy by rplnt on Monday November 27, 2023 @01:29PM (#38436124)
Unless you are doing some (possibly unsafe) magic the interfaces are strongly typed, external dependencies are locked, so one cannot really break an interface without meaning to. Or I guess without realizing it immediately.
Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @02:17PM (#38436841)
I ended up ripping out the unsafe magic, but it was a huge pain while it existed.
Re:Python Is Easy. Go Is Simple. Simple != Easy by jeromenerf on Monday November 27, 2023 @12:41PM (#38435381)
To be fair, most million plus LOC projects match “misfortune” and “nightmare”.
Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @12:49PM (#38435501)
Go is verbose, a million plus LOC doesn't go as far as it would otherwise.
Re:Python Is Easy. Go Is Simple. Simple != Easy by jeromenerf on Tuesday December 05, 2023 @01:14PM (#38534755)
I don't know, my experience with mega SLOC projects were Java, so verbosity was also a thing.

Go's verbosity is usually found in multiples (if err), not in long forms (int[] arrayOfIntegersWithValuesOneToFive = new ArrayFactory().createArrayWithSize(5).populateWithValues(1, 2, 3, 4, 5); ).

Re:Python Is Easy. Go Is Simple. Simple != Easy by sethammons on Monday November 27, 2023 @12:42PM (#38435411)
I think you typed "python" wrong :) Duck typing is a python thing. And the dependency management is a nightmare, constantly breaking. To the article's point - you _must_ run it in a container and defer to the OS to have anything resembling a sane development story.
Re:Python Is Easy. Go Is Simple. Simple != Easy by pjmlp on Monday November 27, 2023 @01:37PM (#38436242)
OP meant structured typing, which is the strong type version of duck typing.

As long as the type supports the same interface anything goes, even it actually supports another one, where the methods have the same name, with different semantics.

Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @12:50PM (#38435525)
Ok that's totally fair. What's the Go name for it? In my mind Go interfaces are duck typed.
Re:Python Is Easy. Go Is Simple. Simple != Easy by sethammons on Monday November 27, 2023 @12:58PM (#38435645)
mostly joking - your complaints are big problems in python. Dependency management in Go has been contentious (historically) with "to vendor or not to vendor", glide and dep, GOPATH, etc. But that is all solved. Go mod for the win.

As far as "the nightmare of {using interfaces}" -- I have no clue to any controversy there. It is one of the most celebrated features of Go. Not sure where you were going with that. In Python, I do find duck typing to be a nightmare because you don't actually _know_ what you have. Can you change it? Try it and if it breaks you will know. Or you use it like a list but it is a string and that gives strange, unexpected behavior, so you end up doing things like `param=force_list(maybe_string_or_list)`.

Re:Python Is Easy. Go Is Simple. Simple != Easy by pydry on Monday November 27, 2023 @01:41PM (#38436307)
The Python typing nightmares you refer to go away on large projects as soon as you start using mypy, which I tend to find most large projects do these days.

So yes, you can change that string and you do know.

It's still better that it's optional and gradual - it's unnecessary overhead on smaller projects, spikes, notebooks, etc. which are what most big projects grow out of.

Re:Python Is Easy. Go Is Simple. Simple != Easy by kietay on Monday November 27, 2023 @01:53PM (#38436508)
Python typing nightmares definitely do not just go away with the use of mypy. There are so so many ways to break out of the guardrails it supplies that are not caught.
Re:Python Is Easy. Go Is Simple. Simple != Easy by pydry on Monday November 27, 2023 @04:11PM (#38438345)
I can write stringly typed code in haskell too if it comes to that.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Biganon on Monday November 27, 2023 @02:14PM (#38436808)
Don't you need stumps which are quite often not available?
Re:Python Is Easy. Go Is Simple. Simple != Easy by lokar on Monday November 27, 2023 @12:58PM (#38435650)
What were they actually doing? Passing interface{} all the time and casting it?
Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @02:09PM (#38436732)
Haha you're spot on. In the codebase I inherited that was everywhere.
Re:Python Is Easy. Go Is Simple. Simple != Easy by lokar on Monday November 27, 2023 @02:39PM (#38437123)
You can do crazy things in any language if you try hard enough.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @09:47AM (#38474156)
The trick to efficient Go is to not try hard, lol
Re:Python Is Easy. Go Is Simple. Simple != Easy by mathisd on Monday November 27, 2023 @01:02PM (#38435703)
Python is duck typed as it support dynamic type, whereas Go doesn't. Yet you can do polymorphism in Go and aside that difference I think Go interface are duck typed.
Re:Python Is Easy. Go Is Simple. Simple != Easy by theLiminator on Monday November 27, 2023 @02:26PM (#38436953)
Probably structural typing?
Re:Python Is Easy. Go Is Simple. Simple != Easy by sroussey on Monday November 27, 2023 @12:56PM (#38435621)
I think you typed “JavaScript” wrong…

;)

Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Tuesday November 28, 2023 @03:58AM (#38443790)
I assume your only part of a larger larger team working on this 1M LOC project? If you are alone with no previous context/knowledge the language does no really matter, you would be in a world of hurt nonetheless.
Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Tuesday November 28, 2023 @06:36PM (#38453198)
I agree with you but that pretty much invalidates Go. The whole selling point is that it is lacking anything to make the language interesting to use but you can drop in and any two Go programmers write the same understandable code.
Re:Python Is Easy. Go Is Simple. Simple != Easy by ingoaf on Monday November 27, 2023 @11:52AM (#38434645)
Don't forget the fact that it doesn't have this overbloated concept of inheritance and polymorphism of let's say Java where you have to look through 6 files to understand what's even going on. Even generics in Go were a heated debate because they make the language more complex. All in all Go was created by geniuses and it shows.
Re:Python Is Easy. Go Is Simple. Simple != Easy by zimpenfish on Monday November 27, 2023 @12:10PM (#38434925)
> it doesn't have this overbloated concept of inheritance and polymorphism of let's say Java where you have to look through 6 files to understand what's even going on

Several Go codebases I've worked on would like a word. Some Go people really love their interfaces and abstractions and making sure every method is only 3 lines and pretty soon you're 20 files and three type hierarchies deep trying to figure out what a single HTTP handler actually does.

Re:Python Is Easy. Go Is Simple. Simple != Easy by mrweasel on Monday November 27, 2023 @12:16PM (#38435019)
A certain number of developers will be able to complicate any language or mechanism you provide them, it's how they feel important. I've notice the there is a group of people who has their entire identity tied up in being "smarter" than everyone else, except they aren't, so they build extremely complex systems, because they think that's what smart people do. They are interestingly often extremely well versed in their tool of choice.
Re:Python Is Easy. Go Is Simple. Simple != Easy by ingoaf on Monday November 27, 2023 @12:27PM (#38435169)
This is actually a real gem of a comment. Thank you for that!
Re:Python Is Easy. Go Is Simple. Simple != Easy by mostlylurks on Monday November 27, 2023 @12:50PM (#38435527)
You are mistaken if you think that the abundant use of interfaces etc. is motivated by anything along those lines. As someone who often puts basically everything behind an interface and abstracts everything in sight, it's not because it has anything to do with being smart, quite the opposite; it's the only way I can keep any meaningful portion of the code in my head. Give me a 5000-line straightforward / unabstracted implementation of something and I'll struggle, but give me thingDoer.doThing(), behind an interface so I don't even have to know how to construct one, and I'll be happy and able to focus on the task at hand. This applies even if I'm the one who wrote the ThingDoer interface and its implementation(s), and even if it was only 30 minutes ago.
Re:Python Is Easy. Go Is Simple. Simple != Easy by ssd532 on Monday November 27, 2023 @01:17PM (#38435934)
This is me as well.

Another reason for me for having interfaces is simple mocking in tests.

Re:Python Is Easy. Go Is Simple. Simple != Easy by chrsig on Monday November 27, 2023 @12:56PM (#38435617)
> They are interestingly often extremely well versed in their tool of choice.

This has become a red flag to me; over attachment to a tool or paradigm means that they're driven by and making decisions using feelings, not through actual analysis.

Re:Python Is Easy. Go Is Simple. Simple != Easy by thruway516 on Monday November 27, 2023 @12:59PM (#38435667)
Very well put. "They are interestingly often extremely well versed in their tool of choice." People who are, shall I say unwise, but very good at what they do is one of the most annoying things wrong with the world.
Re:Python Is Easy. Go Is Simple. Simple != Easy by munificent on Monday November 27, 2023 @05:04PM (#38439070)
> I've notice the there is a group of people who has their entire identity tied up in being "smarter" than everyone else

I've also seen the opposite where people revolve their entire identity around not being the person and they swing too far the other direction and end up being a masochist and doing things the dumb way because they're too afraid of coming across like a snob.

Re:Python Is Easy. Go Is Simple. Simple != Easy by theshrike79 on Monday November 27, 2023 @12:21PM (#38435101)
You can instantly see when the codebase is Java Coder Go or Python Coder Go, they bring their baggage to the language and it shows.
Re:Python Is Easy. Go Is Simple. Simple != Easy by baby on Monday November 27, 2023 @12:15PM (#38435011)
I’ve seen one Golang codebase like this and it was made by Java people
Re:Python Is Easy. Go Is Simple. Simple != Easy by otabdeveloper4 on Monday November 27, 2023 @12:44PM (#38435440)
Yeah, you just described every Go project. Reading Go code is a nightmare of frustrations.
Re:Python Is Easy. Go Is Simple. Simple != Easy by zimpenfish on Monday November 27, 2023 @04:44PM (#38438844)
I disagree because I've seen some readable Go codebases but I wholly agree that bad Go codebases are a nightmare.

Try comparing the Honk source (clear, direct, modulo the unangst wacky names for everything) with GotoSocial (unreadable, interfaces and abstractions out the wazoo).

(Yes, I know GTS supports the MastoAPI but that doesn't force the hellish onion-layer abomination they've created.)

Re:Python Is Easy. Go Is Simple. Simple != Easy by lokar on Monday November 27, 2023 @01:08PM (#38435795)
There is this odd thing where the actual syntax and features of a language are (at least partly) independent of how it ends up being used. A culture forms around the language (that the authors have limited influence over). Java does not have to be used the way most people tend to (factoryfactoryimplfactory!). And some go projects (notably at least early k8s are go in Java style).

A lot of what people comment on is less the language and more the dominant culture.

Re:Python Is Easy. Go Is Simple. Simple != Easy by saturn_vk on Monday November 27, 2023 @01:16PM (#38435924)
No one is safe from bad developers. I've seen go SDKs for paid products that were clearly written by people with only a vague idea what the target language offers. I have to assume such libraries were hammered until the compiler just accepted what was given
Re:Python Is Easy. Go Is Simple. Simple != Easy by EnergyAmy on Monday November 27, 2023 @12:43PM (#38435427)
> geniuses

That's very strong language. Go was created by some smart people that have completely ignored programming language developments that happened after the 70's.

Re:Python Is Easy. Go Is Simple. Simple != Easy by lambda_garden on Monday November 27, 2023 @12:47PM (#38435474)
Ironically, we had more advanced languages than Go in the 70s.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Ferret7446 on Monday November 27, 2023 @07:27PM (#38440630)
Advanced != good. It takes some genius to realize that.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @09:52AM (#38474214)
Yeah, but advanced languages are also a problem for long-term maintainability.

Remember, Go was developed at Google - jokingly, while waiting for stuff to compile. They deal with tens of millions of lines of C++ written by thousands of engineers with varying skill levels and career paths. The advancedness of C++ did not reduce the compile times or readability of the code. At those scales you can't rely on being familiar with a particular section of code; you need to be able to drop in anywhere and know what's going on, without having to learn which subset of the advanced language they used for that particular feature.

Go is not advanced by design.

Re:Python Is Easy. Go Is Simple. Simple != Easy by lambda_garden on Friday December 08, 2023 @05:14AM (#38567283)
Advanced languages can compile quickly - it depends on the feature set chosen. For example, do-notation is an advanced feature not found in most languages, but it compiles quickly as it is syntactic sugar. Operator overload, on the other hand, might require a solver and thus compile slower. It's not a particularly advanced feature, however. Binary optimization passes do not make the language any more advanced (on the user side), but will slow down compilation. Advanced design and compile-times are pretty orthogonal.

As for maintainability, it's not clear to me that reams of imperative code is easier to maintain than something terse and declarative. In fact, probably the opposite.

Re:Python Is Easy. Go Is Simple. Simple != Easy by cogman10 on Monday November 27, 2023 @02:19PM (#38436875)
Yup.

Go made a lot of odd choices from a language design perspective. It's pretty much "C, but with better types and a garbage collector!"

It certainly has its usages and does some nice things. But at the same time, the obsession with compile speed has, IMO, has been a detriment to the language as a whole. We see this in the way generics ultimately entered go after years of causing problems by not existing from the get-go.

Re:Python Is Easy. Go Is Simple. Simple != Easy by aforwardslash on Monday November 27, 2023 @04:37PM (#38438751)
I'd say that the hands-down improvement over C is simplified threading and proper utf8 support. The utf8 alone (because of the notion of rune) is a good reason to use golang over C or C++.
Re:Python Is Easy. Go Is Simple. Simple != Easy by bufio on Monday November 27, 2023 @01:26PM (#38436080)
Maybe you could educate them.
Re:Python Is Easy. Go Is Simple. Simple != Easy by kyrra on Monday November 27, 2023 @12:09PM (#38434910)
It depends on what libraries you use and how you structure your code. Yes, you can create inheritance hell within Java code. But you can also use composition (what Go uses) within Java and create sane code bases.

Inheritance is a foot gun that got overused in the '90s and early 2000s. But people have learned mostly to avoid it unless really needed.

Re:Python Is Easy. Go Is Simple. Simple != Easy by coffeebeqn on Monday November 27, 2023 @11:58AM (#38434738)
I remember looking through this insane taxonomy of abstractions of a button to find the code for when it got pressed. There weren’t that many buttons and they had no special requirements. Just trying not to find some real actual code that does the thing. I work on much bigger projects now with much less abstraction and my quality of life is much higher
Re:Python Is Easy. Go Is Simple. Simple != Easy by Thrymr on Monday November 27, 2023 @12:20PM (#38435081)
> All in all Go was created by geniuses and it shows.

This is not necessarily a compliment to the language. I'm OK with a language created by merely somewhat smart pragmatists.

Re:Python Is Easy. Go Is Simple. Simple != Easy by fh973 on Monday November 27, 2023 @12:56PM (#38435615)
You can write 90s object oriented code in any language.
Re:Python Is Easy. Go Is Simple. Simple != Easy by infecto on Monday November 27, 2023 @11:55AM (#38434684)
This was one of the troubles I always had with Java. It was very hard for me to reason about with some of the wildly nested inheritance.
Re:Python Is Easy. Go Is Simple. Simple != Easy by geraneum on Monday November 27, 2023 @01:51PM (#38436473)
Go was first and foremost created to serve the needs of Google. Kudos to them for releasing, open sourcing and backing it but it was designed to serve their needs. It’s not a criticism but it explains why it’s quirky in many areas. The authors being genius is not as important as the goals and intentions.
Re:Python Is Easy. Go Is Simple. Simple != Easy by pron on Monday November 27, 2023 @02:14PM (#38436801)
To know which interfaces a Go type implements (and so where it can be used) requires reading more, not fewer files than in Java.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Cthulhu_ on Thursday November 30, 2023 @09:55AM (#38474255)
They may be geniuses, but some - mainly Ken Thompson - are also luddites, eschewing things like syntax highlighting. I mean they have a point - if you need colors to make your code readable, your code isn't readable.

But yeah, I love how everything is well thought out and they just say "no" a lot.

Re:Python Is Easy. Go Is Simple. Simple != Easy by farresito on Monday November 27, 2023 @12:04PM (#38434836)
IMO, Go is a mediocre language with great tooling and a great company behind it, and it turns out ultimately if you don't have the latter, the former is irrelevant.
Re:Python Is Easy. Go Is Simple. Simple != Easy by throwaway894345 on Monday November 27, 2023 @12:47PM (#38435471)
Yeah, I also think people index too hard on the language itself, when the runtime, tooling, and ecosystem are all much more important. Moreover, I think "mediocre" is a good thing so long as it means "fewer features" or "simple". I'm kind of glad Go is a mediocre language in this sense, because it gets out of the way. And Go's runtime is similarly "mediocre"--it's fast enough for 99% of applications, it doesn't use a ton of memory by default, the default GC is low latency, goroutines far easier to use than async/await, all it needs is a Linux kernel (no userland dependencies), and it's all small enough to fit in a static binary. Go also has a pretty good standard library too; no need to pull in dependencies just to marshal JSON or make HTTP requests, and everything compiles to static binaries by default so distributing CLI tools internally is a breeze.

Go isn't the best at anything, but it gets 80-90% of the way there on everything whereas other languages aim for 100% in one dimension (e.g., performance, static analysis) at the expense of all other considerations (e.g., usability).

Re:Python Is Easy. Go Is Simple. Simple != Easy by BobbyJo on Monday November 27, 2023 @12:17PM (#38435034)
I dont think there is a language better suited for containerized applications, even web servers more broadly.

Is it the best at everything? No, but it got everything exactly right for its niche imo.

Re:Python Is Easy. Go Is Simple. Simple != Easy by kagevf on Monday November 27, 2023 @02:23PM (#38436919)
And also the actual container infrastructure itself.
Re:Python Is Easy. Go Is Simple. Simple != Easy by baby on Monday November 27, 2023 @12:16PM (#38435027)
Yes, like Python and Javascript right? Turns out you don’t need a great language when you provide what most people want: great tooling, good resources to ramp up, great stdlib, etc. Believe it or not Golang was the first language to do this, and probably still the only one? (Rust misses the mark on great stdlib)
Re:Python Is Easy. Go Is Simple. Simple != Easy by SpaceManNabs on Monday November 27, 2023 @02:13PM (#38436787)
> great stdlib

Many comments say the opposite of this. I am not too experienced, but I do know that go has a great standard library for web apps.

Re:Python Is Easy. Go Is Simple. Simple != Easy by baby on Tuesday November 28, 2023 @05:29PM (#38452335)
I'm pretty familiar with Golang's stdlib and other languages stdlib and I'm not sure what the other commenters are on.
Re:Python Is Easy. Go Is Simple. Simple != Easy by golergka on Monday November 27, 2023 @12:21PM (#38435096)
Typescript (which is 99% of current JS above toy scale) has a company behind it.
Re:Python Is Easy. Go Is Simple. Simple != Easy by packetlost on Monday November 27, 2023 @12:05PM (#38434846)
Most developers are mediocre, so having a language that can match the skill level of the average dev is a win for many situations, no?
Re:Python Is Easy. Go Is Simple. Simple != Easy by kadoban on Monday November 27, 2023 @12:23PM (#38435122)
No. A better language would make things safer for the average dev.

You don't give the new guy at work the saw with all of the safety features removed. Or maybe you do, but you're not doing it for his benefit at least.

Re:Python Is Easy. Go Is Simple. Simple != Easy by mostlylurks on Monday November 27, 2023 @01:03PM (#38435720)
A mediocre language is not the same as a language appropriate for developers of mediocre skills. Go could have been made a better language [0] in many ways that would have actually made it easier than it is right now, by avoiding some of the footguns built into the language. This also wouldn't have made the language more prone to being used in a complex manner by metaprogramming enthusiasts and the like. Better often means simpler, not more complex.

[0]: Not that it's not already decent.

Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Tuesday November 28, 2023 @04:00AM (#38443805)
Yes, i can agree. Go is not my favorite language, but when it comes to pragmatism and developer productivity, Go is up there.
Re:Python Is Easy. Go Is Simple. Simple != Easy by hotnfresh on Monday November 27, 2023 @11:58AM (#38434742)
My favorite thing about Go is that I can read a dependency’s source and there’s a very low probability that the author favors some totally different 30% of the language than I’m accustomed to, so I find it illegible without great effort. Or has imported libraries to add so many language features that it looks totally alien (fucking JavaScript—it’s getting better these days, to be fair, but there was a decade-plus when you just had no clue what you’d see when you opened up an unfamiliar codebase)
Re:Python Is Easy. Go Is Simple. Simple != Easy by baby on Monday November 27, 2023 @12:14PM (#38434990)
The way I describe it is that Golang is optimized for reading, other languages are often optimized for writing. If you have to deal with someone else’s codebase, then Golang is a godsend.

I also like that you pointed out that every Golang codebase looks the same. I think part of that is that Golang’s formatter can’t be customized. I pushed for that to happen in Rust but lost the battle.

Re:Python Is Easy. Go Is Simple. Simple != Easy by throwawa14223 on Monday November 27, 2023 @01:06PM (#38435770)
I don't think I understand where you are coming from. Reading Go code is pretty painful compared to most languages between the specification and the formatter everything looks identical and there is a lack of intentionality. You can't really reason about method signatures or really tell what source will do given the shape.
Re:Python Is Easy. Go Is Simple. Simple != Easy by ghayes on Monday November 27, 2023 @12:27PM (#38435168)
I've actually found Golang codebases to be the hardest to read, mostly due to the non-locality of effects from channels. It's just to easy to read a line of code and not know where to move next.
Re:Python Is Easy. Go Is Simple. Simple != Easy by baby on Tuesday December 05, 2023 @01:35PM (#38535052)
I would argue that code with channels are hard to read in any languages, not just Golang.
Re:Python Is Easy. Go Is Simple. Simple != Easy by saagarjha on Monday November 27, 2023 @12:55PM (#38435602)
I read a lot of code. Reading Go is painful because I have to parse whatever open-coded version of standard algorithms or error handling the developer chose to use that day.
Re:Python Is Easy. Go Is Simple. Simple != Easy by kevincox on Monday November 27, 2023 @02:34PM (#38437073)
This was exactly my experience when I was working in Go. Each line was easy to understand, but reading actual code was painful because I needed to read so much to figure out what was actually being done. I was basically spending 90% of the time mentally simplifying the code into abstractions so that I could understand the business logic. Then once I understood the business logic I had to zoom back in to check that their inlined reimplementation of various basic data manipulation routines were correct.
Re:Python Is Easy. Go Is Simple. Simple != Easy by stouset on Monday November 27, 2023 @02:45PM (#38437208)
Yep. Every layer has to deal with every detail of every problem. So now you get to read dozens of in-line, bespoke implementations of what should be a method call.
Re:Python Is Easy. Go Is Simple. Simple != Easy by baby on Tuesday December 05, 2023 @01:34PM (#38535045)
I used to read code for a living (security consultant) and I'll ask you this question: you're being thrown in a codebase and you need to understand it in a week, what code do you wish the codebase to be. I'll give you the answer: it's going to be the language you work in, and then Golang if it's not the language you work in.
Re:Python Is Easy. Go Is Simple. Simple != Easy by saagarjha on Wednesday December 06, 2023 @02:44AM (#38541384)
This is actually a pretty interesting question; hard disagree on Go though. I work in security but I don't do much formal code review, instead I care more about trying to figure out how things work as fast as possible. Go is easy to "parse" in that the language isn't too complicated but navigating the architecture of complex projects is annoying because there is just so much boilerplate everywhere that I have to cut through. It's kind of like how I feel with Java, despite it being one of my strongest languages. Otherwise I actually do know a fair number of languages well enough to comfortably navigate around projects that use them; I think C and JavaScript projects are generally not too bad, C++ can be pleasant or painful depending on how things are structured, and Python is also a toss-up. Rust, Swift, Scala, Kotlin are usually pretty good. Of the languages I really don't know I think I would rank Ruby as one of the worst, maybe TypeScript on the better side?
Re:Python Is Easy. Go Is Simple. Simple != Easy by EnergyAmy on Monday November 27, 2023 @12:48PM (#38435484)
Brainfuck is also super easy to read, and all codebases look the same. That's not a good thing. A language optimized for reading wouldn't clutter most of a screen with "if err != nil". Something like Rust's `?` would be a far better option.

Agree that the limited formatting options is nice, though.

Re:Python Is Easy. Go Is Simple. Simple != Easy by theshrike79 on Monday November 27, 2023 @12:25PM (#38435128)
Exactly. Code is read WAY more often than it's written.

Go is verbose, that's true. And if the speed of writing code is the biggest hurdle in your productivity you're either a true 100x coder savant or deluded.

Go is boring, boring is good when you need shit to work every time. And especially when you can't pick the top1% geniuses to work on it and might need to bring some rando up to speed to the project AND language quickly.

Re:Python Is Easy. Go Is Simple. Simple != Easy by dave4420 on Monday November 27, 2023 @02:13PM (#38436781)
Go is verbose. That slows me down when I’m _reading_ code. Especially when it means the chunk of code I’m reading doesn’t fit on my screen.
Re:Python Is Easy. Go Is Simple. Simple != Easy by stouset on Monday November 27, 2023 @02:47PM (#38437223)
Or when I have to pick out what the actual logic is amidst a forest of error handling. Or mentally deconstruct some complicated loop to figure out it's just doing a map, filter, reduce.
Re:Python Is Easy. Go Is Simple. Simple != Easy by baby on Tuesday December 05, 2023 @01:36PM (#38535061)
Java is verbose, C++ is verbose, Golang is not. Golang actually cared about verbosity. For example, uppercase letter means that your function is exposed, no keyword!
Re:Python Is Easy. Go Is Simple. Simple != Easy by avgcorrection on Monday November 27, 2023 @11:59AM (#38434759)
> No matter what your opinion is about Go (as a language), but they nailed it for bigger projects.

I don’t understand this template?

1. No matter your opinion on X:

2. Opinion Y is true about X!

If all you have are compliments about X: just go directly to (2). You’re not making a begrudging concession, after all.

Re:Python Is Easy. Go Is Simple. Simple != Easy by wsc981 on Monday November 27, 2023 @12:03PM (#38434815)
I think the way it's meant to be read and understood is as follows:

"There may (or may not) be many problems with Go, but building bigger projects is not one of those".

Re:Python Is Easy. Go Is Simple. Simple != Easy by stouset on Monday November 27, 2023 @01:55PM (#38436545)
This is actually kind of funny because one of the classical arguments made by gophers eight or so years ago when I first started learning it was that golang's limited abstraction power makes the pain of large codebases obvious enough that teams are incentivized to keep projects small.
Re:Python Is Easy. Go Is Simple. Simple != Easy by goodpoint on Monday November 27, 2023 @12:33PM (#38435263)
A form of whataboutism.
Re:Python Is Easy. Go Is Simple. Simple != Easy by papichulo2023 on Monday November 27, 2023 @12:42PM (#38435410)
Well... It kinda replaced Java for most cloud stuff except for Kafka.
Re:Python Is Easy. Go Is Simple. Simple != Easy by Nullabillity on Monday November 27, 2023 @06:28PM (#38440048)
Or the related fallacy, "X was designed to be good at Y, so clearly X is good at Y!" (or worse, "is the best way to do Y!").
Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Tuesday November 28, 2023 @04:02AM (#38443822)
I basically mean:

No matter if you dislike Go you cant argue with the fact that it is a good fit for larger teams collaborating on a big multi-year/multi-decade project.

Re:Python Is Easy. Go Is Simple. Simple != Easy by distortedsignal on Monday November 27, 2023 @12:26PM (#38435158)
Ok, maybe you can help me figure something out that I haven’t been able to.

I’ve got a project broken down into modules. Module A uses module B. These are both checked into GitHub, so the module path is something like guthub.com/distortedsignal/my-project/src/a or whatever.

I need to make a change across both of these modules. Will my compilation pick up the changes?

What if I need to make a backward-incompatible change in b when b is a fully separate project?

Re:Python Is Easy. Go Is Simple. Simple != Easy by Groxx on Monday November 27, 2023 @12:38PM (#38435332)
>I need to make a change across both of these modules. Will my compilation pick up the changes?

Yes, add a replace directive to A's go.mod and point it to B's directory. It'll pick up changes immediately. You can also vendor + disable modules + change stuff in the vendor folder to quickly experiment, though IDEs tend to get moody about this.

Backwards incompatible in principle: release a new major version of B. Import and use that.

Backwards incompatible in practice: few projects actually do that reliably, IMO because tooling to help you do this or detect the need is somewhere between "bad" and "horrifyingly bad". Most just make the breaking change, increase the minimum version in A, and it'll work for anyone who stays up to date on A (this is often good enough for internal use). Though people updating B separately by hand might break.

Re:Python Is Easy. Go Is Simple. Simple != Easy by kubanczyk on Monday November 27, 2023 @01:42PM (#38436315)
> Yes, add a replace directive to A's go.mod and point it to B's directory. It'll pick up changes immediately.

Nowadays you just create a go.work file. That's much less cumbersome than 'replace' directives.

If a module is in the go.work it isn't downloaded from a remote git repo, but overshadowed by your local files.

Re:Python Is Easy. Go Is Simple. Simple != Easy by Groxx on Monday November 27, 2023 @03:33PM (#38437854)
Ehhh... I find it far more similar than not in terms of effort/maintenance, and much less likely to work with [random tool X] tbh. Replaces work with basically everything, and you can vendor when they don't - workspaces have no vendor equivalent AFAIK.

go.work is also rough to use with existing folders / a gopath-like setup, because they're super awkward if you don't have a dedicated folder with dedicated clones with just the stuff you're using in the workspace (which has some nice benefits, but most people are not even aware you can do that afaict, GOPATH caused so much pain that there's now mental scar tissue that'll take a while to clear). Replaces work fine with that if you open two editor instances, workspaces generally index everything or nothing and get confused.

Tooling support has likely improved since I last tried it (around 1.19?), and I 100% agree that it's a viable option worth considering (thanks for the comment!), but I'm not sold on them yet. Better for some things, worse for others.

Re:Python Is Easy. Go Is Simple. Simple != Easy by distortedsignal on Monday November 27, 2023 @01:15PM (#38435896)
Ok, I wasn’t able to figure that out when I was in the codebase.

What do you do if you’re working in a fork of the project and you need to make those changes?

Re:Python Is Easy. Go Is Simple. Simple != Easy by Groxx on Monday November 27, 2023 @01:27PM (#38436091)
Should be the same. You can replace to any location, and with modules it doesn't even need to follow GOPATH naming conventions.

E.g. clone A and fork-B into adjacent folders regardless of fork status or import paths, and change A/go.mod to include

   replace original.com/B ../B
and that should work fine.

With GOPATH you would need to clone the fork into the original path. Which you can do if needed / modules don't prevent that either, but modules don't need any specific locations at all.

---

The official module doc is... huge and doesn't spell things out in an easily-usable form, so you're far from alone in your confusion, but I do think it's worth reading. I routinely find people spending way more time struggling with them than it would take to read the spec and become an expert on it: https://go.dev/ref/mod

Re:Python Is Easy. Go Is Simple. Simple != Easy by distortedsignal on Monday November 27, 2023 @04:23PM (#38438535)
Wow. You’re right - that is simpler than I expected. Thank you!
Re:Python Is Easy. Go Is Simple. Simple != Easy by pif on Monday November 27, 2023 @12:06PM (#38434864)
> they nailed it for bigger projects.

Yeah, indeed, big projects did not exist before!

Re:Python Is Easy. Go Is Simple. Simple != Easy by phplovesong on Tuesday November 28, 2023 @04:05AM (#38443840)
They sure did! But in what shape do they exist in today? Depending on the language you might find N ways of doing something, where N = amount of devs who has worked on the project. Most likely you have a huge mess.
Re:Python Is Easy. Go Is Simple. Simple != Easy by asylteltine on Monday November 27, 2023 @12:52PM (#38435555)
Go is an amazing language. I use it for everything. It’s easily the best new language of our generation for getting shit done
Re:Python Is Easy. Go Is Simple. Simple != Easy by lambda_garden on Monday November 27, 2023 @01:00PM (#38435673)
What's strange is that Java predates Go and has all of these attributes. C# too, for that matter.
Re:Python Is Easy. Go Is Simple. Simple != Easy by closeparen on Monday November 27, 2023 @01:35PM (#38436210)
As someone who mostly writes request-handling services, I just don't think propagating errors through gateway/repository -> controller -> handler layers deserves 90% of my attention. But unfortunately that it is where it goes doing microservices glue type stuff in Go.
Re:Python Is Easy. Go Is Simple. Simple != Easy by turtleyacht on Monday November 27, 2023 @02:51PM (#38437279)
Backward compatibility (BC)