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
add Throwable and Error #916
Comments
@gavinking I think we can close this |
I agree. Thanks Tom! |
OK, reopening this, because somehow it didn't occur to anybody to think through what this was going to mean on a JS VM. FFS! |
So, AFAICT, there is no way in JS to portably detect something like an out of memory or stack overflow. So we're going to have to totally rethink this shit from the ground up. AFAICT we're going to have to remove |
After reviewing the situation with JS, it seems to me that what we need to do is:
|
I'm not convinced this is a huge problem. We're not going to have Ceylon exception types for those things, so we're not claiming they're necessarily represented via the exception hierarchy (or represented at all). I think Anyway, going along with your proposal for now:
|
I don't think that we should get rid of |
No,
So we need to remove it. We really didn't think this one through at all. |
No.
OK, sure, I agree, that's a good reason. |
|
I suppose |
Actually we can't make |
I thought it might make sense if we made the |
Actually it might be interesting to make |
In this case, sealed in its own wouldn't solve the erasure problem, it would have to be Anyway, how would making it |
Well, it all depends upon what you think |
|
Well, it certainly means you can't do it in Ceylon code. Not much we can do to enforce |
But what problem does using The problem is that on the one hand I can't erase |
No specific problem, it just tells people that exceptions they define in Ceylon should be either |
I'm going to make I can't make The metamodel throws |
You mean like |
Well, we could just throw |
|
…ve that directly extends Throwable (in ceylon), but actually extends (j.l.Error in the JVM runtime).
I have pushed a
Once we have that I we can merge the branch and I can push my compiler changes. |
Great, thanks. |
|
OK, changes pushed to |
When I try to build a dist using your language module and js compiler it dies like this:
|
Ah, so ModelError is indeed gone... You'll have to edit MASTER.js and remove that class from the list of compiled sources (sorry I don't think I'll have time today to fix it myself) |
Btw MASTER.js is in ceylon.language/runtime-js |
OK, all those branches etc have been merged. Could @gavinking review before closing this issue? |
@tombentley Well there's just one thing wrong with this. Consider: try {
throw AssertionError("oops");
}
catch (Error error) {
print(error.message);
} This code prints "oops". But according to the definition of So I think we need some special stuff in |
Even worse, this code results in a backend error: try {
throw AssertionError("oops");
}
catch (Error error) {
//error.printStackTrace();
print(error.message);
}
catch (AssertionError ae) {
print("ok");
} |
I guess some reordering of catch clauses or inserting of regrowing clauses could fix that. |
um but |
He means java lang Error, I think |
Closing, after opening ceylon/ceylon-compiler#1741. |
We have decided, finally, to add
Throwable
andError
classes, which erase tojava.lang.Throwable
andjava.lang.Error
, thus reflecting the model that exists in the Java VM.The text was updated successfully, but these errors were encountered: