News for hackers. Stuff that matters.
Re:Things from Python I'd miss in Go by zimbatm on Tuesday June 10, 2014 @09:54AM (#7872446)
The readConfig example is not really an issue in go. Just return the io error and type switch after the readConfig.

    if config, err := readConfig(ioReader); err != nil {
      switch err.(type) {
      case io.ErrClosedPipe:
        // do one thing
      case ParseError:
        // do something else
      case ...
      }
    }
Re:Things from Python I'd miss in Go by drdaeman on Tuesday June 10, 2014 @10:01AM (#7872479)
> Just return the io error

Manually, on every function call that may fail - that was my only point why exceptions may result in a clearer code.

    section, err := parseSection(ioReader)
    if err != nil { return nil, err }
Has some boilerplate, as compared to a typical exception-based

    section = parseSection(reader)  // throws IOError
Re:Things from Python I'd miss in Go by zimbatm on Tuesday June 10, 2014 @10:52AM (#7872826)
Yeah I get what you mean.

If you forget that "throws" comment then the Java code is opaque to the exception. I think Go developer see a value in having errors exposed explicitly, it forces them to think about how to handle them instead of having a catch-all at the top of the program. But now we're down to philosophy and personal taste :)