Re: Dealing with exceptions in a drawing stack
Re: Dealing with exceptions in a drawing stack
- Subject: Re: Dealing with exceptions in a drawing stack
- From: "Kyle Sluder" <email@hidden>
- Date: Wed, 14 Jan 2009 23:53:46 -0500
On Wed, Jan 14, 2009 at 11:34 PM, Graham Cox <email@hidden> wrote:
> If an exception is thrown from somewhere down inside this stack, I'd prefer
> it if I could continue to draw what can be drawn, rather than have to abort
> the drawing altogether which usually leaves the whole view in a weird state
> (at which point I'm hosed - I have to abandon that document and create a new
> one, which is hardly user friendly).
This is known as a "continuation". Scheme, for example, often uses
them instead of exceptions. Much like a jmp_buf, It contains all of
the information necessary to resume execution at the point the
continuation is created. In the event of an error, an error handler
is invoked with the continuation object, at which point the error
handler can inspect the error condition and potentially modify the
state such that execution can continue to proceed. It then executes
the continuation and the program resumes where it left off.
This isn't the model that exceptions follow, unfortunately. By the
time your @catch block has caught the exception, the stack has already
been unwound and you can't get it back.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden