3 ms·
It's just an improvement on error handling in C without introducing heavyweight exceptions.
by bigdict 5y ago
It's just an improvement on error handling in C without introducing heavyweight exceptions.
- erik_seaberg 5y agoThey did introduce panic, they just discourage anyone outside the language design team from taking advantage of it. I find "better than C" to be a pretty disappointing target.
- dragonwriter 5y ago> They did introduce panic, they just discourage anyone outside the language design team from taking advantage of it. The guidance I remember when I was trying out go and researching idiomatic Go style was not “don’t use panic in your code” but “don’t expose panics [other than the ‘always and everytime fatal’ kind] across the public API surface of your code”. Basically, if someone other than the code owner would want to react to it, it should be converted to an error return before hitting the code consuming your library.
- eyelidlessness 5y agoThis is my understanding too, and when I’ve seen panic I always see it treated as fatal/terminating.