Issue 18394 in dart: language: guarantee that rethrow preserves stack trace identity

15 views
Skip to first unread message

da...@googlecode.com

unread,
Apr 23, 2014, 6:07:37 AM4/23/14
to bu...@dartlang.org
Status: Triaged
Owner: ----
CC: b...@google.com, gbra...@google.com
Labels: Type-Defect Priority-Unassigned Area-Language Milestone-1.4

New issue 18394 by kas...@google.com: language: guarantee that rethrow
preserves stack trace identity
http://code.google.com/p/dart/issues/detail?id=18394

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));


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

da...@googlecode.com

unread,
Apr 23, 2014, 6:09:56 AM4/23/14
to bu...@dartlang.org
Issue 18394: language: guarantee that rethrow preserves stack trace identity
http://code.google.com/p/dart/issues/detail?id=18394

This issue is now blocking issue dart:15171.
See http://code.google.com/p/dart/issues/detail?id=15171

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

da...@googlecode.com

unread,
Apr 23, 2014, 6:36:15 AM4/23/14
to bu...@dartlang.org
Updates:
Status: Accepted
Owner: gbra...@google.com

Comment #2 on issue 18394 by gbra...@google.com: language: guarantee that
rethrow preserves stack trace identity
http://code.google.com/p/dart/issues/detail?id=18394

If you feel it's important, we can certainly do that. I find it an odd
guarantee to make.

da...@googlecode.com

unread,
Apr 23, 2014, 7:51:39 AM4/23/14
to bu...@dartlang.org

Comment #3 on issue 18394 by l...@google.com: language: guarantee that
rethrow preserves stack trace identity
http://code.google.com/p/dart/issues/detail?id=18394

I'm also not convinced that the stack traces need to be identical.
Can you explain why you think it is important?

da...@googlecode.com

unread,
Apr 23, 2014, 11:04:40 AM4/23/14
to bu...@dartlang.org
Updates:
Cc: nw...@google.com efor...@google.com

Comment #4 on issue 18394 by seth...@google.com: language: guarantee that
rethrow preserves stack trace identity
http://code.google.com/p/dart/issues/detail?id=18394

(No comment was entered for this change.)

da...@googlecode.com

unread,
Apr 23, 2014, 3:34:54 PM4/23/14
to bu...@dartlang.org

Comment #5 on issue 18394 by nw...@google.com: language: guarantee that
rethrow preserves stack trace identity
http://code.google.com/p/dart/issues/detail?id=18394

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.

da...@googlecode.com

unread,
Apr 25, 2014, 4:33:46 AM4/25/14
to bu...@dartlang.org

Comment #6 on issue 18394 by kas...@google.com: language: guarantee that
rethrow preserves stack trace identity
http://code.google.com/p/dart/issues/detail?id=18394

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.

da...@googlecode.com

unread,
Jun 2, 2015, 11:54:42 AM6/2/15
to bu...@dartlang.org

Comment #11 on issue 18394 by sig...@google.com: language: guarantee that
rethrow preserves stack trace identity
https://code.google.com/p/dart/issues/detail?id=18394

Whats the current status on this?

The spec 2nd edition says about rethrow (17.10):

> Let f be the immediately enclosing function, and let on T catch (p1, p2)
> be the immediately enclosing catch clause (17.11).
> A rethrow statement always appears inside a catch clause, and any catch
> clause is semantically equivalent to some catch clause of the form on T
> catch
> (p1, p2). So we can assume that the rethrow is enclosed in a catch
> clause of
> that form.

> The current exception (16.9) is set to p1, the current return value
> (17.12)
> becomes undefined, and the active stack trace (17.11) is set to p2.

This last sentence reads to me as if the stack trace objects must be
identical.

da...@googlecode.com

unread,
Jun 2, 2015, 2:32:18 PM6/2/15
to bu...@dartlang.org

Comment #12 on issue 18394 by gbr...@google.com: language: guarantee that
rethrow preserves stack trace identity
https://code.google.com/p/dart/issues/detail?id=18394

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.

da...@googlecode.com

unread,
Jun 2, 2015, 5:01:37 PM6/2/15
to bu...@dartlang.org
Updates:
Status: Fixed

Comment #13 on issue 18394 by sig...@google.com: language: guarantee that
rethrow preserves stack trace identity
https://code.google.com/p/dart/issues/detail?id=18394

Great, thanks! I'm closing this issue as fixed and move forward with fixing
the dart2js implementation.
Reply all
Reply to author
Forward
0 new messages