[MacRuby-devel] MacRuby questions

Joshua Ballanco jballanc at gmail.com
Sat Jun 30 07:12:16 PDT 2012


On Thursday, June 21, 2012 at 5:46 PM, Kevin Walzer wrote:
> Hello all,
> 
> 


Hi! and Welcome!
 
> I had a few questions about MacRuby and its differences from standard
> C-Ruby:
> 
> 1. Is MacRuby mature enough to function as a drop-in replacement for 
> standard Ruby? Are there significant gaps in functionality? 
> Specifically, does ffi work? (I tried to run a "hello world" ruby-tk app 
> using the ffi and ffi-tk gems, but MacRuby just segfaulted with an error 
> code of 11.)
> 
> 


The answer to this question is slightly complicated:
* MacRuby passes ~90% of the rubyspec.
* The only "significant" gap, to the best of my knowledge, is Fibers. That said, there is a rather clever implementation of Fibers on top of GCD from alskip (https://github.com/alskipp/MacrubyFibers), which I've been meaning to integrate.
* There are still issues running Rails, so if you want to use that as a benchmark, MacRuby is "not quite there yet"

As for FFI, it does not work. Part of the reason is that we had been waiting for the API to settle (early on there were various competing ideas of how Ruby FFI should work). Presently, it is probably as settled as it will get, so it would be good to look into an implementation.
 
> 2. Is it possible to have a command-line toolchain/workflow for
> development and deployment of MacRuby apps, or is heavy use of Xcode 
> required?
> 
> 


A command-line only workflow is definitely possible. I have used such a workflow in the past. Depending on what you are attempting to do, it may involve xcbuild, so you would still need Xcode installed, but compilation and linking can all be done without Xcode. That said, many people have found Xcode helpful when designing UIs. We could probably do a better job of providing a way to make UIs without Xcode.
 
> I like the fact that MacRuby would make AppleScript support for my app
> easy, and the macruby_deploy tool seems to be what's missing from 
> standard Ruby--gathering all bits and libs into an app bundle, running 
> install_name_tool where necessary, etc. The segfault with ffi-tk, 
> however, has me concerned (this particular lib has been advertised to 
> work with any and all Ruby implementations including JRuby).
> 
> 


Until FFI is more fleshed out, you might also try using the Tk.framework in MacRuby. You should be able to use it similarly to how you might use it from Obj-C (though, I am wholly unfamiliar with Tk). You can load the framework in MacRuby by using the "framework" command:
> framework "Tk"

The framework will be loaded using the BridgeSupport definition file, which is a kind of FFI. If you run into any problems, be sure to let us know.

Cheers,

Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20120630/f4ab3b5d/attachment.html>


More information about the MacRuby-devel mailing list