Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any actor or coroutine implementations for Cocoa?




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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Any actor or coroutine implementations for Cocoa? (From: Jens Alfke <email@hidden>)
 >Re: Any actor or coroutine implementations for Cocoa? (From: Jens Alfke <email@hidden>)
 >Re: Any actor or coroutine implementations for Cocoa? (From: "Michael Ash" <email@hidden>)
 >Re: Any actor or coroutine implementations for Cocoa? (From: Jens Alfke <email@hidden>)
 >Re: Any actor or coroutine implementations for Cocoa? (From: "Michael Ash" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.