Sorry for the delay. I was working hard on an improved implementation. On 9/26/05, mathew <meta / pobox.com> wrote: > XML has namespaces so that there can be multiple elements with the same > base name. Ruby 'require' already supports that--you can have require > 'foo/set.rb' and require 'bar/set.rb', the same way you can have > <foo:set> and <bar:set>. Sort of. XML namespaces are references. So foo: and bar: could actually be referencing the same space, in which case they'd be the same 'set'. That's kind of what Require Namespaces does: It allows you to require a 'name' that will be searched for in alternate/multiple directories. > I still don't understand how this namespace proposal improves things, > other than to reduce typing. Can you give an example? I use it to organize a very large library. I've organized the lib according to principles that make sense for development --in this case it's a collection of general purpose libs so I've put classes in one directory, modules in another, etc. But I don't want the end user to have to "path down" so far, so the namespace allow all the folders to be grouped together. So intead of: mylib/classes/foo.rb mylib/module/bar.rb the user can just do: mylib/foo.rb mylib/bar.rb Morover, it makes it easy to add aliases. For instance this could work too: mylibs/foo.rb mylibs/bar.rb As things stand there is no way to do this. One could use symlinks but you'd have to maintain them and they are not cross-platform. > >But that's the point. I'd rather not maintain a single directory with > >100+ files? No, I'd rather break them up into some reasonable > >categories, even though I want the end user to be able access them > >through one interface. > > > > What's wrong with having a file mylib/integer.rb which simply consists of > > require 'mylib/system/byte.rb' > require 'mylib/system/word.rb' > require 'mylib/special/prime.rb' > require 'mylib/positive.rb' > require 'mylib/negative.rb' On this side of things the problem is the attachment of an absolute name, 'mylib'. Using namrspaces one can use relative naming. So for example mylib/integer.rb could just be: require 'system/byte.rb' require 'system/word.rb' require 'special/prime.rb' require 'positive.rb' require 'negative.rb' Moroever one could actually move the whole lib to yourlib/ and it would work just as well. No need to adjust every file's require statements. T.