4 ms·
only the language runtime and operating system would be allowed to raise exceptions So you still need all the exception machinery, but "normal" code can't
by al2o3cr 7y ago
only the language runtime and operating system
would be allowed to raise exceptions
So you still need all the exception machinery, but "normal" code can't use it? Seems like a terrible situation.
Also, who's in charge of deciding what's "language runtime" and what isn't?
- Jare 7y agoIt's not really about who can use it, but rather what it is used for - language runtime can't use it for anything they want. So if a systems-level feature of the language is supported in part by runtime code, that's a place where this may happen, e.g. the Go Runtime throwing a stack overflow. Of course the counterpoint is that C++ and to some extent Java are designed for allowing user code to create system-level facilities, so we're back to the land of "please don't misuse exceptions."
- __s 7y agoThis is how it's done in Rust. panic macro unwinds stack for tracebacks, there's std::panic::catch_unwind, but panic can be compiled to be aborts to do away with stack unwinding, error handling is meant to be done with Result<T, E> type, whereas panic is meant for unrecoverable errors
- riwsky 7y agoThis is not an apples-to-apples comparison. In Rust, app code can panic, even though it’s not idiomatic. That does not meet the standard prescribed by the quote from the article.
- notacoward 7y ago> who's in charge of deciding what's "language runtime" and what isn't? Maybe the people who define the language? Who implement and package its standard compilers/interpreters? This is not confusing outside the world of empty rhetoric.