From: TRANS Date: 2005-09-27T06:40:23+09:00 Subject: Re: Require Namepaces and RubyGems' effect on LoadPath problem On 9/26/05, Austin Ziegler wrote: > Two things. 1. I don't see any particular reason for this. It's neat, > but I don't see why it's necessary. 2. If something is loaded from a > particular "namespaced" path, that path should remain on the load > list, because not everything in a path may actually be loaded with a > single require. It circumvents the need for a #require_local. In doing so it reduces "dependencies" in lib files. What I mean by that is I don't have to specify absolute paths in internal lib files. For instance in Nano. 'nano/integer/even.rb' was: require 'nano/integer/odd' require 'nano/integer/multiple' class Integer def even? ... But now with this is can simply start: require 'integer/odd' require 'integer/multiple' Having added 'nano' => [ 'nano' ] namespace. As for #2, they can't remain on the load path, b/c it would fill it up with local locations. You just reuse the namspace it you have another one to load: in my program: require 'nano' # adds the namespace require 'nano:integer/odd' require 'nano:integer/factorial' Finally, it also allows one to organize ones lib directory independently of how they are required by the end-user. For instance: $LOAD_SPACE['somelib'] = %w{ somelib/onedir somelib/onedir/subdir somelib/twodir } T.