On Tuesday 24 November 2009 04:21:03 pm Robert Klemme wrote:
> On 11/24/2009 07:06 PM, David Masover wrote:
> > On Tuesday 24 November 2009 06:43:20 am Robert Klemme wrote:
> >> Btw, one disadvantage of using a directory glob is that it is far more
> >> expensive than the standard autoload because the standard autoload
> >> does not need any file system IO before any file is loaded.  Using
> >> directory globbing on the other hand requires to at least read the
> >> directory which may slow down startup of a script considerably.
> >
> > Except that standard autoload is more work for me, and nearly defeats the
> > point. Trading requires for autoloads directly makes things harder to
> > debug without making them easier to write -- it _only_ optimizes start
> > time.
> 
> Yeah, absolutely.  If your major goal is to simplify script writing this
> is definitive a good option.  I just wanted to point out that the
> convenience comes at a price. :-)

Well, I want a sane balance. I want to optimize start time to where an app 
starts in under a second, versus thirty seconds -- and I think I've done that 
without much additional complexity.

In other words, I think it's the best of both worlds.

If I _only_ wanted to simplify script writing, Ramaze has a much simpler 
solution -- they've defined Kernel#acquire, which requires every .rb file in a 
given directory tree. That's easier to write and easier to use, but as an app 
gets bigger, it would get slower.