Re: Any actor or coroutine implementations for Cocoa?
Re: Any actor or coroutine implementations for Cocoa?
- Subject: Re: Any actor or coroutine implementations for Cocoa?
- From: "Michael Ash" <email@hidden>
- Date: Wed, 30 Apr 2008 15:35:04 -0400
On Wed, Apr 30, 2008 at 12:18 PM, Jens Alfke <email@hidden> wrote:
> On 29 Apr '08, at 7:16 PM, Michael Ash wrote:
> > There were a lot of problems with Cocoa and returning to the runloop
> > without returning back the way I came
> >
>
> Yes, I can see that there would have to be a rule that only the main
> coroutine (i.e. the original 'real' stack) gets to use the runloop.
>
> I think this can be dealt with by having (in your example) a separate
> coroutine that brings up the sheet; then that coroutine blocks until the
> sheet is dismissed, returning control to the main routine that returns back
> to the runloop.
This doesn't work because you can have multiple sheets which get
dismissed out of order.
For example, method X shows sheet A, method Y shows sheet B, user
dismisses sheet A. Now you need to return back to method X but method
Y is still on the call stack. There's no real way to resolve this
while still presenting a synchronous interface to the sheets. This is
the sort of thing coroutines are made for, but it doesn't work with
"foreign" code on the stack.
> In the actor model, most of the application code would be in the form of
> actors waiting for specific events (menus, buttons, etc.), that would get a
> message when the event occurred, do their thing, then return or yield. The
> main routine would mostly be receiving the events from the runloop and
> dispatching them as messages to actors.
Right, so you ought to have an easier time of it here. You'll still
have to deal with exceptions and autorelease pools but they're not too
bad.
Mike
_______________________________________________
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