4 ms·
Trust us, it's not as bad a this. For one, you can make few initial changes and then zone out fixing type errors, whereas this is entirely manual.
by Ericson2314 6y ago
Trust us, it's not as bad a this.
For one, you can make few initial changes and then zone out fixing type errors, whereas this is entirely manual.
- skybrian 6y agoI’m still not seeing how it’s different. Go is a compiled language. You can change a function’s type and let compile errors tell you the callers that need to be changed. Seems pretty similar? Except for when it’s harder, as the blog post describes. I would guess it’s not all zoning out in a functional language either?
- Ericson2314 6y agoThe problem is type systems---be it Go, Java, Haskell[1], C++, or Rust[2]---don't really mind if you ignore the values expressions turned into statements. All these `err` value business if having to remember to inspect and propagate. The stuff Haskell and Rust do however make the type system far more aware of the issue. In Haskell, all the control flow is "reified" with Monads, which allows the type system (which is data-oriented) to be aware of everything and help much more. In particular, there is no way to "do sequential things" without also handling the errors or lots of extra work that is obvious readinng and wouldn't happen by accident writing. The situation in Rust isn't quite as straightforward, because there are still genuine control flow operations being used. However, Sum types are still a huge help in that they properly model what is produced (either a success value or error value), and #[must_use] makes sure the Results aren't ignored completely. Again, the path of least resistance is doing the right thing, and anything else is very obvious reading. ------------------------- This is a long response, but if I could say just one thing, it's wouldn't programming language theory but economics. It's important not just for Rob Pike or O'Rielly books to preach the right thing, but for the right thing to be a) the easiest and shortest thing to write b) the shortest and "unmarked" thing to read Haskell and Rust succeed here, Go fails miserably. ------------------------- [1] Thank goodness there is #[must_use], but to be fair that is linting post type checking. [2] The moral equivalent of this problem in Haskell is the type of `seq`. But importantly the Monadic approach doesn't need to use `seq`.