4 ms·
I think the real value of panic/recover over try/catch is the vastly improved idiomatic usage. Only to be used in exceptional cases, and never to cross package
by jlgreco 14y ago
I think the real value of panic/recover over try/catch is the vastly improved idiomatic usage. Only to be used in exceptional cases, and never to cross package boundaries.
I just find that so much more pleasant.
- charlieflowers 14y agoHmmm, interesting. The "defer" approach is a different spin on things. But yes, panic/recover does look like it would address my concerns. I never did like exceptions across package boundaries much, but inside a cohesive module I want to use them instead of a bunch of code that checks return values for error codes.
- charlieflowers 14y agoAlthough, another post above says it's not idiomatic, so I guess working with go means accepting the lack of an exception mechanism.
- pkulak 14y agoNo, jlgreco had it exactly right.