Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

I disagree that panic/recover is worse than exceptions, I find it a more pleasant and lightweight mechanism, but the big difference is that panic/recover are not used like exceptions at all in Go, they are basically used only for programmer errors.

They can be used for other things, but in those cases they never cross API-calls so you never have to worry about whatever a library you call might panic, you can basically ignore panic/recover exists completely, and do just fine, and that is what most people do most of the time.



Well, we can argue about whether or not an exception mechanism is the best way to deal with program error conditions, but my first point still stands, which is that Go does not have a proper exception mechanism. If defer/panic/recover were to be used as a true exception system you would run into all the issues Andreas details.




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

Search: