New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug#10166 Make AssertionError fatal #6320
Conversation
3a53db2
to
1498d05
Compare
review by @SethTisue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this LGTM, but I'd like to know what @viktorklang and at least one other Scala team member think
@@ -12,7 +12,7 @@ package util.control | |||
/** | |||
* Extractor of non-fatal Throwables. Will not match fatal errors like `VirtualMachineError` | |||
* (for example, `OutOfMemoryError` and `StackOverflowError`, subclasses of `VirtualMachineError`), `ThreadDeath`, | |||
* `LinkageError`, `InterruptedException`, `ControlThrowable`. | |||
* `LinkageError`, `InterruptedException`, `ControlThrowable`, AssertionError. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit: missing backquotes around the added name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, you're right. will fix shortly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed now
I don't think it's a bug to catch I think this change will break a lot of working code for little benefit (or negative benefit). That a failed assertion is an error is itself, arguably, an error. |
counterargument: |
Shouldn't people be using |
I anticipated your counterargument with the "that it is an error is an error" comment :P In practice, it is not used in cases where termination of the JVM is the only sane option. |
okay. (I don't have a strong opinion of my own on this, actually.) |
@Ichoran Do you have some examples of where people use |
@NthPortal - The scaladocs on Furthermore, you find, even in the Scala library, things like
inside |
1498d05
to
44ed3c2
Compare
IMO using |
@Ichoran That's true, they don't. My assumption was that it was meant to have the same semantics as |
In case you want to check out how it's used in the Scala library, here's the output of a quick grep:
I see far more things that while bad should be catchable than things that shouldn't be caught. |
Looking at if (idx >= newlen && w != 0L) newlen = idx + 1
if (idx < newlen) newelems(idx) = w
else assert(w == 0L) If I will have a look at the other uses in the library, but I suspect they all check invariants. |
fwiw, I think whether, out in the wild, people know or respect the difference, I have no idea |
@Ichoran "uncatchably" seems like hyperbole to me, changing the definition of |
I think that there's a real risk that code will break due to this change. |
Though the majority of uses in the Scala library are as an invariant, at least 3 are not, and thus |
I think it might be worth discussing whether or not the semantics of |
It looks like this is not a good idea right now, possibly ever |
thank you @NthPortal for the attempt. the ensuing discussion was valuable. I closed the original ticket as wontfix. |
Fixes scala/bug#10166