Patrick May wrote:
> 
> Has this been discussed in the past?
> 
> setting Kernel.require to recursively require a dir if passed a
> directory, as in:
> 
> require 'aDir'
> 
> This would load all libraries within 'aDir', as if you did something
> like:

Not really supporting that the idea gets into the language, but if it
does, I'd rather see it called explicitly require_all or
recursive_require or something. 

The reason is that the above does get ambigous when you omit the .rb or
..so part of a require, which I do very frequently. (That is, so
frequently, I keep forgetting to add the extension when I use load...) 

../aDir.rb
../aDir/x.rb
../aDir/y.rb

What should 
 require 'aDir'
do in this case?

 
> def recursive_require( filename )
>     if File.stat(filename).directory?
>         Dir[filename].entries.each { |entry|
>             recursive_require( entry )
>         }
>     else
>         require filename
>     end
> end
> 
> Does this sound stinky, or nice?

Stinky in require, nice as a helper method, but not something I'd like
to see less one asks for it in a script by doing 
	require 'advanced_require'
or something... 
or 'ftools' perhaps, since you're basically doing
	File.each_requireable_file_recursively{|filename| require filename}
:-)

IMHO

-- 
(\[ Kent Dahl ]/)_    _~_    __[ http://www.stud.ntnu.no/~kentda/ ]___/~
 ))\_student_/((  \__d L b__/  NTNU - graduate engineering - 4. year  )
( \__\_?|?_/__/ ) _)Industrial economics and technological management(
 \____/_?_\____/ (____engineering.discipline_=_Computer::Technology___)