Hacker News new | past | comments | ask | show | jobs | submit login

Currently the only way out of a function is via the `return` keyword, or, exceptionally, panic. Those are easy to spot and easy to understand. With try, especially if it's nested in a complex statement e.g.

    fmt.Fprintf(os.Stdout, "%s: %d\n", try(getID()), try(getCount()))
a function may return in surprising places.



I'm not sure that they are easy to spot.

   fmt.Fprintf(os.Stdout, "%s: %d\n", getID(), getCount())
Could have hidden panics in it and you would never know.


Yes, but panics are exceptional, and not something you need to worry about when doing a normal code review. Try would be commonplace.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: