I find this attitude extremely frustrating, because basically all of my work involves either writing programs with meaningful exit statuses, or writing programs that run programs that should have meaningful exit statuses, but sometimes don’t, because people like you think it’s a forgotten relic of the past and no longer important.
Because of this, it’s very important to me that casually-written Rust programs get it right, and that means the language should make the most ergonomic thing be the right thing.
?-in-main is an opportunity to do exactly that, but only if it doesn’t panic.
As far as portability, the minimal case - 0 is success, nonzero is failure - is portable to all operating systems that even have exit statuses, and as far as I know the operating systems that don’t have exit statuses are embedded things where you aren’t supposed to return from
main at all.
There’re always two exits for main(): returning and unwinding. Returning from main() does not necessarily mean that the program won’t panic at a later stage.
Under what circumstances can the program panic after
main returns, without this being a straight-up bug in the runtime that needs to be fixed? (Note: drop-handlers for things that go out of scope as
main returns do not count as “after main”. They are part of the program. And they’re drop-handlers, so they need to not fail, period.)