-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
language: guarantee that rethrow preserves stack trace identity #18394
Comments
Marked this as blocking #15171. |
I'm also not convinced that the stack traces need to be identical. |
For a practical use case, this property is critical for implementing stack chain capturing as is currently done in the stack_trace package. It uses an expando on stack traces to track the prior traces in the chain, but this only works if the same stack trace has consistent identity over time. Stack chains are an important tool for debugging asynchronous code, but currently they don't work under dart2js because it doesn't support this property. |
Not sure I understand the argument against guaranteeing this? We have to specify that rethrow preserves the original stack trace somehow (that's 100% essential) and the simplest way of specifying what preserving means is to say that it preserves identity. Also, it's by far the simplest way of implementing it. |
Removed this from the 1.6 milestone. |
Removed Oldschool-Milestone-1.6 label. |
Whats the current status on this? The spec 2nd edition says about rethrow (17.10):
This last sentence reads to me as if the stack trace objects must be identical. |
We did introduce this wording into the second edition (it was not there in the first edition). I forget the history, but as worded, it does imply that rethrow preserves the stack object. |
Great, thanks! I'm closing this issue as fixed and move forward with fixing the dart2js implementation. Added Fixed label. |
See issue #15171. I think it makes sense to put this in the language spec as it is a core property of the rethrow semantics.
var e0, e1, s0, s1;
try {
try {
throw 42;
} catch (e, s) {
s0 = s;
e0 = e;
rethrow;
}
} catch (e, s) {
e1 = e;
s1 = s;
}
assert(identical(e0, e1));
assert(identical(s0, s1));
The text was updated successfully, but these errors were encountered: