What is the point of nothrow?
jmh530
john.michael.hall at gmail.com
Fri Jun 15 18:16:57 UTC 2018
On Friday, 15 June 2018 at 17:29:39 UTC, bauss wrote:
> [snip]
>
> There is a reason that I have not gotten rid of this:
> http://diamondmvc.org/docs/logging/#database-logging
>
> It just _works_ most of the time and really helpful when you do
> not have access to the server and/or the standard
> output/console.
I wouldn’t doubt that a lot of behavior depends on the current
approach of Errors inheriting from Throwable. I’m sure you find
value in it the way it is and I bet it would be a pain to change
it.
Instead, what if they introduced an UnthrowableError that does
not inherit from Throwable and just kills the program without
unwinding the stack or whatever else people find objectionable
currently? The current Error could be re-named Throwable Error
and then a new Error could be introduced that has version
statements such that whether to call ThrowableError or
UnthrowableError depends on switches when you compile. This way
you can still have the behavior that you like, though maybe the
default would change at some point in the future.
The only breaking changes I can figure would be if people are
assuming that Error always inherits Throwable, when it wouldn’t
if using the UnthrowableError switch.
More information about the Digitalmars-d-learn
mailing list