Re:Conc: Better Structured Concurrency for Go
by jaitsu on Thursday January 12, 2023 @09:10AM
(#34353693)
You can recover from a panic though, so if you are implementing something that may panic you should have some sensible defer/recover in there if you can't afford to have your process crash.
Re:Conc: Better Structured Concurrency for Go
by preseinger on Thursday January 12, 2023 @06:32PM
(#34361798)
Division by zero, dereferencing a nil pointer, invoking methods on a nil interface, invalid indexing of an array, unchecked type assertions -- these are not common operations! These are always easily detectable programmer errors.
And there are some operations where you cannot check in advance whether a panic will happen: comparing interfaces (underlying values might not be fully comparable), indexing a map (could blow up during any concurrent write), and closing or sending to a closed channel.