Modify `throw` opcode to pass through pre-configured resume continuation #531

Open
aghast opened this Issue Feb 16, 2010 · 3 comments

Comments

Projects
None yet
4 participants

aghast commented Feb 16, 2010

Presently, the throw opcode creates and sets a resume continuation on the exception being thrown.

Since 'resume' is an attribute of the Exception, throw should check first for a preconfigured continuation, and if one exists should preserve it.

(Of course, if unset it should continue to do what it does.)

Originally http://trac.parrot.org/parrot/ticket/1448

Owner

pmichaud commented Feb 19, 2010

On Tue, Feb 16, 2010 at 01:10:16AM -0000, Parrot wrote:
>  Presently, the throw opcode creates and sets a resume continuation on the
>  exception being thrown.
>
>  Since 'resume' is an attribute of the Exception, throw should check first
>  for a preconfigured continuation, and if one exists should preserve it.
OOC, how does this differ from 'rethrow'?
Pm
Contributor

jkeenan commented Sep 17, 2010

Austin,

Can you respond to pmichaud's query or indicate whether this is still a concern?

Thank you very much.

kid51

Contributor

Whiteknight commented Oct 24, 2011

Just because rethrow happens to have a certain signature and semantic now doesn't mean that rethrow will always be usable as a "throw plus a new resume continuation" in the future. In fact, rethrow doesn't have exactly that semantic right now, though the differences are subtle.

I would much rather call a throw a throw, and call a rethrow a rethrow, and not rely on using one op to perform the other operation just because it happens to work that way in a particular revision of Parrot.

Adding a new variant of the throw op which takes a resume continuation would be a good experiment to run. I think the current throw op automatically sets the resume continuation in the exception, so we need to evaluate that behavior to see if it's what we really want. For instance, if an exception already has a resume continuation set, maybe we don't want to blindly overwrite that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment