News for hackers. Stuff that matters.
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.