by bb88 · 3y ago · 0 comments
Errors : Fine.
Panics : Weird because golang already had errors.
Segfaults: Gah! (though this is a cgo issue apparently)
See
https://news.ycombinator.com/item?id=37908655
and
https://rachelbythebay.com/w/2023/10/16/env/It is true that panic allows any value to propagate, so technically you can use it to carry errors, along with anything else you can imagine (names, email addresses, audio, whatever).
But the intent is for it to be used for communicating exceptions. You will notice panic's behaviour mirrors exception handling systems found in some other popular languages. But errors, along with names and email addresses for that matter, are decidedly not exceptional.