[MacRuby-devel] MacRuby promise
jdmuys at kleegroup.com
Mon Nov 14 08:15:53 PST 2011
Reading from many messages on this list, I get the impression that MacRuby users are more often than not Ruby programmers coming to Mac programming.
I come from the opposite side: I am an experienced Cocoa developer and Ruby newbie.
I came to MacRuby for one major reason (and perhaps a few secondary reasons): to speed up development of my Mac applications.
My vision of speeding up Mac development is basically to finally reach again what I had almost 20 years ago when I was programming in Macintosh Common Lisp on the Mac for the Mac: developing within a running application, without having to quit it, dynamically adding or modifying classes or methods through a read-eval-print loop.
Yet, after having read through Matt's book, this is not what I got. On the contrary, my workflow is at the opposite end of the spectrum: built-run-test-quit loop, similar to what I'm used to with Objective-C. Except it's even worse: at least, typos are caught early with Objective-C. With MacRuby, they aren't, and quite often, I spend a considerable time reaching the point I'm working on before I get an exception from my typo.
Since MacRuby *does* have a REPL in the macirb terminal program, I really hope I missed something (that unfortunately is not described in Matt's book): what would be an efficient workflow developing a MacRuby Macintosh application with Xcode?
For example, I see that all Ruby code is loaded in rb_main.rb by walking through the app bundle resource directory and calling require(path) on all found ruby files.
Would it be possible to require again those files after they have been modified, without quitting the application? Yes it would still require building the app after each change in order to copy the changed ruby files back into the app bundle, but at least Xcode is happy to do so without requiring the app to quit (just don't ask it to "Run").
Even better, would it be possible to optionally require the ruby files from the source directory rather than from the app bundle (during development) based on some scheme or configuration dependent symbol? Then building the app would not even be necessary after changes limited to Ruby source code.
I would envision MacRuby Xcode templates to include such improvements in rb_main.rb, and also to add a "Debug" menu of some sort to the built app from which the developer could select a command to reload any/all changed Ruby file. This could even be automated using File System events.
The workflow loop would then become:
1- test some app action
2- notice a bug. Don't quit. Switch to Xcode.
3- change the relevant Ruby file
5- there is no step 5
I can't see any reason why this would not possible, and even easy, Ruby newbie as I may be. To me, this is the major MacRuby promise, and that promise is not kept yet.
Am I out of my mind?
(and add a Ruby console/listener to the built app too, in which the REPL is working in the context of the running app).
More information about the MacRuby-devel