I struggling to think of any language that can provide this guarantee. Even Python can segfault while executing C extensions. Maybe java?
I struggling to think of any language that can provide this guarantee. Even Python can segfault while executing C extensions. Maybe java?
import sys
sys.setrecursionlimit(1048576)
def recurse(): recurse()
recurse() import ctypes
ctypes.string_at(0)"No_Exceptions - Raise_statements and exception_handlers are not allowed. No language-defined run-time checks are generated; however, a run-time check performed automatically by the hardware is permitted."
Source: http://www.ada-auth.org/standards/12rm/html/RM-H-4.html
If the underlying operating system or board support system have similar support then panic situations would be avoided entirely.
While this is a highly-specialized case, it is defined and supported by high integrity Ada implementations / runtimes.
https://www.adaic.org/resources/add_content/docs/95style/htm...
"If you disable exception checks and program execution results in a condition in which an exception would otherwise occur, the program execution is erroneous. The results are unpredictable"
It would be easy enough to also scan the source for sources of panics.
eval((lambda:0).__code__.replace(co_consts=()))- System.Diagnostics.Debug.Assert (on debug builds)
- Envinroment.FailFast (this is precisely what panic! is usually used for)
- void BlowUp() { BlowUp(); }
But, in reality, any unexpected Exception: how would you properly handle an unexpected NRE or index out of bounds? Either swallowing the exception (bad) or aborting.
That's not strictly true: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
Not exactly; “panic” is what Go calls exceptions.
Rust “panic!” macro, though, is more of a gentle abort (I guess it's like an uncatchable exception, but that qualifier so radically changes the nature that I can't see it as really the same kind of thing.)