Panic

From Adam Colton
Jump to navigation Jump to search

This is a real hangup for me. I don't like panic/recover because it breaks linear flow. But I want something like this for the compiler. If the compiler can show that a panic will be hit, it can return that panic as a compiler error. This lets library return compile time errors.

Application

One option is just to allow an application to panic. This lets the compiler see what errors will trigger the base panic, but a library can't panic.

Fatal

Panic without recover. With the right tooling it would be possible to show any cases where a fatal could be possible and protect them.

Threaded

Fatal could be limited to killing a thread. As long as it's not the main thread, the application will continue.