Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: throw instead of panic in runtime #25201
For discussion; I don't know whether this is a good idea.
The runtime uses slices. Though the runtime contributors Never Make Mistakes, slice accesses can panic. Most such panics are very bad news. However, they might be caught by another package's recover. That's why we have throw.
We might want to have the compiler automatically insert throwindex instead of panicindex, throwslice instead of panicslice, etc. when compiling the runtime.
I don't think so. That's for observable panics. These "panics" are failures of the language implementation, and this change just makes sure that those take down the process rather than letting it continue in a broken state.