On 14 Nov 2011, at 8:15 AM, Jean-Denis MUYS wrote:

> 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.

I like this idea quite a lot.  Rails works similarly: in development mode, it 
reloads all classes upon a request.  There is some trickiness to this, and it 
doesn't work 100% (for reasons I can't remember now), but it certainly saves 
time over stopping/starting the full Rails process.

In the Cocoa environment, I wonder whether there would be hassles with 
re-initializing classes that use notifications and delegates?  All those object 
references would have to be set up upon each reload.  I believe the Rails 
solution to this is a particular convention of blocks that are executed upon 
loading a module.

> 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").

As you're certainly aware, there's nothing special about the app bundle.  One 
could even edit it in place, removing the need for copying files at all.  I 
understand the Xcode templates aren't set up for this, but I can't think of 
anything stopping you from doing so.

> 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.

So then, at least for development, the app bundle becomes a tiny skeleton that 
has a modified rb_main.rb (to require files from outside the bundle, watch for 
changes in those files, automatically reload them).  Additionally, it has a 
controller (& associated nib file) to handle the REPL window.  I like it.

--John

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to