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: Jens Alfke <email@hidden>
- Date: Wed, 30 Apr 2008 14:37:05 -0700
On 30 Apr '08, at 12:35 PM, Michael Ash wrote:
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.
That's what would happen without coroutines. But with coroutines it's
no problem, because X and Y aren't on the same call stack:
Coroutine 1 is running:
...
method X calls runSheet(A)
runSheet displays the sheet, then blocks and transfers control
Now coroutine 2 is running:
...
method Y calls runSheet(B)
runSheet displays the sheet, then blocks and transfers control
Main coroutine is running:
...events being handled...
User clicks on OK button in sheet A
Main coroutine wakes up coroutine 1
Coroutine 1 is running:
sheet goes away, runSheet(A) returns
back to method X
...
The main coroutine would handle the runloop and events as usual. But
it would respond to events by messaging their associated coroutines/
actors.
—Jens
PS: I just updated the coroutine library. I rewrote the underpinnings
to make them simpler, and added a call/yield style interface similar
to Ruby's and Lua's.Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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