Re:I was wrong, reflecting on the .NET design choices
by kjksf on Friday April 21, 2017 @05:53PM
(#14169726)
so does panic() in Go. But no-one claims that Go uses exceptions for error handling, because it doesn't and neither does Rust.
In both languages panic() is for "this shouldn't happen" fatal errors, not for signaling errors to the caller, the way Java or C# use exceptions.
My comment was in response to person basically saying "checked exceptions in Java would be good if only they implemented it the way Swift/Rust did".
Rust panics result in unwinding the stack:
https://doc.rust-lang.org/nomicon/unwinding.html
try!/? is preferred for handling errors, but if you "know" that a Result or an Option has a value, you can unwrap() or expect() it, and you'll get a panic if you're wrong.