Re:Alan Donovan and Brian Kernighan Answer Questions on Go
by jamwt on Friday November 20, 2015 @04:38PM
(#10604045)
A better example is the timeless:
err := f1()
if err != nil {..} // have to do this or compiler error
err = f2()
// oops, forgot to actually do anything about it!
Now, granted, `go vet` helps with this, but.. these kinds of things can be solved by the language proper in much better ways, and they should be type errors. Like rust's `Result` or Haskell's `Either`.
Edit: rust's result is especially nice with #[must_use]. This has saved my team from mistakes relatively frequently.
Edit: rust's result is especially nice with #[must_use]. This has saved my team from mistakes relatively frequently.