[MacRuby-devel] MacRuby promise
mattaimonetti at gmail.com
Mon Nov 14 08:22:40 PST 2011
Very good point Jean Denis. You are totally right, it shouldn't be hard to
reload all the Ruby source while the code is running. One thing tho, you
might also have to reset the state of your application, including its
drawing state. But maybe we could leave that up to the developers.
What I'm thinking is to test this theory, we could write a small
application addon which adds an extra window calling into 2 methods: reload
Reload would basically do rb_main.rb does, reset would reset the state of
the app after reloading the source files.
We should also be able to open a REPL window to introspect the code in real
time. I believe Alloy or Vincent were working on something similar.
On Mon, Nov 14, 2011 at 1:15 PM, Jean-Denis MUYS <jdmuys at kleegroup.com>wrote:
> 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
> 4- save
> 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).
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the MacRuby-devel