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 (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to