5 ms·
Annoying as hell, that's what you get when you don't support exceptions.
by eta_carinae 14y ago
Annoying as hell, that's what you get when you don't support exceptions.
- eternalban 14y agohttp://play.golang.org/p/WUxODxK_4r http://play.golang.org/p/WUxODxK_4r
- masklinn 14y ago> that's what you get when you don't support exceptions. That's what you get when you refuse to use them anyway. Go has exceptions, there's just a dogma about never using them.
- skelterjohn 14y agoYou can't really use panics as exceptions. If you do your code will be strange and hard to work with. This strangeness is fine, because they aren't meant to be used like that. A good rule of thumb is to use panics when it's a programmer error indicating a bug.
- luriel 14y agoNot dogma, just common sense based on experience. Panic() is for truly irrecoverable exceptional situations where you do not expect the caller to catch it.