[MacRuby-devel] Feedback: Dispatch high-level wrappers

Ernest N. Prabhakar, Ph.D. prabhaka at apple.com
Fri Feb 12 11:25:10 PST 2010


Hi Jordan,

On Feb 12, 2010, at 11:12 AM, Jordan K. Hubbard wrote:
> That's definitely a good start, yes, though I must confess to not quite understanding the dispatch.fork example?

All Dispatch.fork does is allow you to access the return value of the block (whenever it is available), either synchronously or asynchronously.  In other words, I'm trying to make Futures duck-type to Ruby threads, with allow a return 'value'.

I've annotated the file with return values, which may make things a bit clearer.

>> http://svn.macosforge.org/repository/ruby/MacRuby/trunk/sample-macruby/Scripts/gcd/dispatch_methods.rb

Perhaps part of the problem is that I'm using the same method for return both synchronously (direct) and asynchronously (continuation passing style).  It leads to a more concise API, and a fairly powerful pattern once you are used to it, but perhaps that is overly clever.

What do you think?

I'm also working on a full-fleged article that uses actual, y'know, sentences, which may help once it is done...

-- Ernie P.





More information about the MacRuby-devel mailing list