Hi all, One quick change -- I redid Futures to duck-type to Thread instead of lambda:
> http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/future.rb and changed Dispatch.fork to use that instead: > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/dispatch.rb Do let me know if you have any other suggestions. Thanks! -- Ernie P. On Feb 8, 2010, at 5:46 PM, Ernest N. Prabhakar, Ph.D. wrote: > Hi all, > > As hopefully you all know, MacRuby 0.5 includes wrappers for almost all of > the C "dispatch" APIs for Grand Central Dispatch. While relatively > straightforward to use, the APIs are somewhat verbose and C-ish. > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/spec/macruby/core/gcd/ > > For MacRuby 0.6, I'd like to provide higher-level convenience APIs to reduce > the "cognitive overhead" and "semantic noise" of using Grand Central > Dispatch. In other words, let people do what they want without having to > learn or type as much as they do now. > > My first attempt at this is a new 'dispatch' library: > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/ > > which (from the latest MacRuby nightly) you can access via: > > require 'dispatch' > > This defines: > > - A Dispatch::Actor class which wraps a given object with serialization and > asynchronous callbacks > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/actor.rb > > - Convenience methods on the Dispatch module > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/dispatch.rb > > - Parallel extensions to Enumerable > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/enumerable.rb > > - A Futures class for delayed execution (duck-typed to lambda) > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/future.rb > > - a 'stride' function on top of Dispatch::Queue#apply > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/queue.rb > > - Queue-based source constructors > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/lib/dispatch/queue_source.rb > > I've also written up specs to both test and demonstrate these constructs: > > http://svn.macosforge.org/repository/ruby/MacRuby/trunk/spec/macruby/library/dispatch/ > > These are *extremely* preliminary, and lacking in both polish and > documentation. They may not be entirely correct, or even the appropriate > abstractions to release as public API. However, I wanted to get something > out there to provoke feedback, so we can iterate together. Hopefully we can > also use this thread to start learning how to explain both the concepts and > the API, as it evolves. > > So, feedback away! > > - Ernie P. > > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel